Sunday, May 31, 2009

A new desire came from one of our customers. The request was to have the ability to search in Panorama Crosstab. The first solution I thought of was searching the grid in iterative way and it worked fine using the Panorama SDK. After that, my friend Boris came with another simple and elegant solution: We can use Parameter in the Panorama view and highlight the number which was defined in the parameter. In this post I'll explain how to implement this.

1. Create a new view using Panorama NovaView Desktop and make sure you see the grid in the view.

2. Define a new parameter: Click on View -> Paramaters, and click on the "Manage Parameters" button. Click on Add. The default type is Number and this is exactly what wee need (for now). In the name, type Highlight and in the Default Value type a number that you see in the grid (this is the number that will be highlighted later). Let's take 0 for example. Click on OK twice and close the little Parameters window.

3. Create a new Exception: Click on Data -> Exceptions -> Exceptions... -> Add. Click on Next and then choose "Custom Exception". Click on "Edit Exception" and there write the following formula: [Measures].CurrentMember = [[Highlight]]
This will simply select all the cells with the number that we defined earlier in the Highlight parameter. Click on OK and click Next. In this step, define the style of the highlighted cells. I picked red color and Bold font style. You can click on Finish now and then click OK. Open the small Parameters window (right click in the crosstab's corner and choose Parameters) and click on "Apply Changes". Now, you will see that all the cells with 0 are highlighted. If you don't see it, check that you did all the steps correctly.

4. When we will show the view to the user, we don't want to show him anything highlighed when the view is loaded. This is where a little trick takes place: open the small Parameters window (right click in the crosstab's corner and choose Parameters), double click on the Highlight parameter. Choose String as the parameter type (on the right part) and in the Default value, enter abc. Click twice on OK and then on the apply button and you'll see that now the highlighed cells are regular ones.

5. In the dashboards page, or in the web page you created using the Panorama SDK, create a button that will call the function searchGrid. Just add the button the property onclick="searchGrid('master')", where master is the applet's name. this is the code of the searchGrid function:

function searchGrid (applet) {
var reply = prompt('Please enter the number to search','');
eval(applet + '.CallUpdateParametersEx("P|~|Highlight|~|' + reply + '|~~|")');
}

Another tweaks I implemented and I didn't write in this post in order to make it simple (for advanced developers only):
  • You can search all the views in the current web/dashboard page. Just call the function for every applet, but make it in Batch mode.
  • You can search all the grid even if the user doesn't see all the rows. You can tell him if the number he searched for is in there or not.

That's all. Test your new page and enjoy. For every question about this and anything else, you can leave a comment or write my mail.

 | 
Sunday, May 31, 2009 6:11:47 PM (Jerusalem Daylight Time, UTC+03:00)
 Monday, May 25, 2009

After a long break from blogging, it's time to get back on the course. In the last weeks I worked hard on two BI projects so I didn't had any time to write, but the good news is that I learned a lot and now I have more to share. Now, let's talk about the Panorama Dashboards web site.

When you build many pages with the NovaView Dashboards, you often find yourself repeating the same code and actions in different pages, which stands in conflict with the DRY principle. The solution to this problem is to maintain a global javascript file and reference it from your custom code. That way, you'll edit only one js file all the time. Take my advice and put the file in VSS or any other source control. Every page's custom code will be only the code which is unique to the page. The bigger problem is that during development, you still need to create many pages, reference them to the global js file and make very page's own manipulations. I don't have a silver bullet solution, but the next tip can save you much development time.

Warning: Before doing anything with your DB, back it up.

Behind the Dashboards web site, there's a little database called PanoramaDashboard which contains all the web site's data. In this post, I'll discuss the Tabs table. The Tabs table is maybe the most important table in this DB. Every row in that table is a page in the Dashboards web site. When I create a new page that is very similar to another one, I click on "Create a copy" in the web site (on design mode, of course) and then I run the following SQL command in the DB:

use [PanoramaDashboard]
Update Tabs
set
CustomCode = (select CustomCode from Tabs where Id=YourPreviousPage'sId),
UseCustomCode = 1,
Name = TheNewPage'sName
where Id = (the new page Id. You can see in the page's address in the address bar)

After that, edit the custom code from the DB (very similar SQL command). You'll have to enter manually the new Applets names/Ids. Don't try to duplicate the page using the DB because it won't work.

If you did some mess with the order of the pages in the section or you just want to re-organize the pages, you can re-order it using the same Table. Just change the FatherId of the page. Note that a father must be a folder, so you need to set Folder=1 and that a page with no father will have FatherId=-1. Again - don't try to enter manually a whole row because it will break the web site (you'll have to remove the identity from the Id column and that can cause you much trouble).

Enjoy. and be careful.

Monday, May 25, 2009 10:18:46 PM (Jerusalem Daylight Time, UTC+03:00)