The Company
Products
Solutions
Services and Support
Customers
Partners
News
Events
Home >> News >> WebFOCUS Newsletter >> February 2004 >> Under the Covers: Resource Layout Painter Gives It ALL in Release 5.2.4

Under the Covers: Resource Layout Painter Gives It ALL in Release 5.2.4

By Brian Carter

With all of the great features in the Resource Layout Painter, you may think the tool has it all. Well, one thing was missing, and that was ALL. The ALL feature, as we call it here on the product team, allows a developer to add a value of ALL to any multi-select parameter listing.

This is a huge time saver for developers used to hand-coding line after line of JavaScript and/or Dialogue Manager. A single mouse click in the Layout Painter automatically takes care of all of that coding. Nice, huh?

Now, what this means for users is that they will have a default option in their drop-down lists allowing them to quickly view the data for all of the parameter values. This is basically a shortcut seen in most well thought-out and professional-looking Web applications. Nobody should have to click on every single value in a huge drop-down list. It’s unnecessary and time consuming. Well, WebFOCUS has finally built this type of functionality into its arsenal of parameter-driven reporting features.

Let’s quickly go over the process for setting up a multi-select parameter that has the ALL value. First things first, let’s create a report with parameters in the Report Painter. I won’t go over every step of creating a report in this article, but I’ll pick it up at the parameter creation step to explain some crucial steps.

Let’s say we have a sales report based on Gotham Grinds demo data. We have UNITS summed by REGION, ST and CITY. We’ll create dynamic parameters for the three sort fields and then we are going to "chain" these together in the Layout Painter. Let’s take a look at the code generated by the Report Painter and make a few notes.

1.	TABLE FILE GGSALES
2.	SUM UNITS
3.	BY REGION
4.	BY ST
5.	BY CITY
6.	HEADING
7.	"Regional Sales Report"
8.	FOOTING
9.	"As of: <+0>&DATEtrMDYY <+0> "
10.	WHERE ( REGION EQ 
&REGION.(OR(Midwest,Northeast)).Region:. );
11.	WHERE ( ST EQ 
&STATE.(OR(CA,CT)).State:. );
12.	WHERE ( CITY EQ 
&CITY.(OR(Atlanta,Boston)).City:. );
13.	ON TABLE SET PAGE-NUM OFF 
14.	ON TABLE NOTOTAL
15.	ON TABLE PCHOLD FORMAT 
'&WFFMT.(HTML,PDF,EXL2K).Select format:.'
16.	ON TABLE SET HTMLCSS ON…

Everything here is pretty straightforward, but take a look at lines 10-12 and note that the WHERE statements are independent of each other. It is critical that these statements are created individually and not attached to each other with AND. It’s very easy to construct a compound WHERE statement in the Report Painter, but that will not work properly when using the ALL option. Here’s why: FOCUS has a new feature that is the secret to making the ALL option work. A special keyword FOC_NONE has been added to the FOCUS language that if returned to the reporting engine will bybass the parameter and return all values for that field. When you add the ALL option to your dynamic parameter in the Layout Painter, this is the value that is returned to the server when ALL is chosen. So it would be necessary to have an independent parameter statement for each parameter that will have the ALL option assigned to it. Otherwise, returning FOC_NONE to any one of the parameters in a compound WHERE statement will result in the entire parameter statement being bypassed. Also note that FOC_NONE will not work with parameter statements that span multiple lines, so make sure your WHERE clauses are contained to a single line. (Note: The example in this article has the WHERE clauses spanning multiple lines due to space limitations on the page.)

Now that we have a report with parameters, let’s create a launch page in the Layout Painter. Create a new procedure and choose Resource Layout Painter as the tool to use. Add a hyperlink and fill in the properties. Click the Run Report option and browse to the report that you just created. Type in Run! for the Display Text and select Frame for the target. Simply type in a new name for the frame and it will be created for you automatically. (Don’t forget to change the frameborder property to No if you want to make the output blend into the background page.)

Now you should have all of your controls for the report parameters. Note that since the hyperlink object is still active, you may have to click somewhere else on the page for the controls to be built. Now make each parameter dynamic by highlighting the control and selecting the data source and field in the parameters area. Also uncheck the Select ALL checkbox for each one since that is only applicable to a static parameter. (Yes, you can use the ALL option for static parameters as well.) Once the parameters have been made dynamic, we can chain them together. Click on each parameter (REGION, STATE, and CITY) in the order in which you want them to chain. In other words, you are setting the parameter hierarchy with the order in which you click them. Once you have selected the parameters, you can chain them by simply clicking the Add to Chain option. Note that the chaining order will be indicated with small numbers on the upper left hand corner of the controls. See Screen 1. Now run the report and see the parameters in action. The chained parameters will be updated with each selection and you’ll see that ALL is automatically added to the controls. See Screen 2 for an example of the “filtered” report data output in PDF format.

Screen 1

Screen 2

Note that the PDF output is displayed in a new window. That’s because I right-clicked on the hyperlink and selected Open in New Window. That built-in browser function is a great reason to use hyperlinks instead of buttons. Remember that you can always style the hyperlink to resemble a button if desired. Well, that’s a quick demonstration of another powerful and simple solution available for one of today’s basic reporting needs.