Thursday, November 10, 2011

Hiding Symbolic Variables from WebFOCUS HTML Composer

One of the powerful features of WebFOCUS is the ability to symbolically represent data, content, and instructions--basically anything in a program--and process these variables with a procedural scripting language, known as Dialogue Manager.

Sometimes, symbolic variables are created and used only within a single program. In this case, WebFOCUS developers use the -SET command to dynamically specify a variable's value. The syntax of the -SET command is varied; statements can be a simple assignment, logical with an IF-THEN-ELSE statement, mathematical, process strings, call subroutines, or a combination of these. 

At other times, values for symbolic variables are just passed into the program after having been set elsewhere. For example, your WebFOCUS program may get parameter values from an HTML launch page, another WebFOCUS program, or some other technology. Either a human user or an application could be passing in the desired values. 

Best Practices

For these types of symbolic variables coming from an external source, it is a best practice to always provide a default value. If WebFOCUS runs a program where no value has been assigned to a symbolic variable, it will automatically prompt you for the value (assuming this feature is turned on, otherwise it will just fail).

For a software developer creating WebFOCUS programs, it is also nice to have default values inside the code instead of having to retype them each time you run a specific module.

Within the program, always explicitly identify the variables that will be passed in from the outside. There also seems to be a common practice (I'm not sure who started this, but I see it at many WebFOCUS accounts) of naming these variables with &XP_. Other developers will tell you to use names as short as possible to avoid hitting a URL string-size limitation in the IE browser. 

Default Values

You provide default values for these external variables using the -DEFAULT command.

Unlike the -SET command, -DEFAULT only allows simple assignments. It is also different from all other  non-procedural WebFOCUS commands, in that it is executed when (and other if) needed at the beginning of the process regardless of its location in the code sequence. Because of this, most WebFOCUS developers avoid confusion by grouping their -DEFAULT commands at the top of their modules.

HTML Composer

With all that said, it is important to understand that the Developer Studio's HTML Composer evaluates the WebFOCUS programs for these symbolic variables. When it sees the -DEFAULT commands, it assumes that you will want to create HTML controls for these symbolic variables.

If these parameters need to be passed from the HTML launch page to the WebFOCUS program, the HTML Composer is making a very good choice. The launch page needs corresponding controls and logic to pass parameter values to WebFOCUS properly.

However, your WebFOCUS programs may be passing parameters to each other (e.g., in report or graph drill-downs) and the HTML launch page does not need to know anything about it.

In a situation where you have symbolic variables being passed into WebFOCUS programs from a source other than the HTML launch page, you can instruct the HTML Composer to ignore these using an alternative form of the default command, which is -DEFAULTH.

The H in -DEFAULTH stands for "hidden." Do not confuse this with a hidden input control in the HTML sense of the word (since those often still need to be passed from HTML to WebFOCUS). Instead, you are marking it to be hidden from the HTML Composer.

When you link a WebFOCUS program to an HTML inline frame, the HTML Composer will parse your program and offer to build controls for any of the -DEFAULT variables and ignore those with -DEFAULTH.

This is a very nice feature added to the core WebFOCUS language to help you build HTML launch pages. 

0 comments:

About Me

My Photo
Doug Lautzenheiser is a leading subject matter expert in the use of Business Intelligence software within corporate organizations. He is one the top authorities in the WebFOCUS BI software product, from Manhattan-based Information Builders. While a vendor employee, Doug was trained and certified in IB's BI products all the way through the internal workings of the software.

During his 13-year career with IB, Doug led regional education, consulting, and pre-sales technical support services. In addition to being a software vendor employee, Doug spent 7 years with IB customers and 5 years with IB partners.

Doug has provided BI services to organizations such as Procter & Gamble, Wendy's/Arby's Group, Omnicare, TriHealth, Hormel Foods, JPMorgan Chase, MasterCard, the State of Indiana, the State of Oklahoma, and the Choctaw Nation of Oklahoma.

Doug is general manager of Partner Intelligence, a Cincinnati-based consulting firm specializing in BI professional services such as strategic advice, BI application development, and tools/methodologies for automating BI application development tasks.