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. 

No comments:

About Me

My photo

I am a project-based consultant, helping data-intensive firms use agile methods and automation tools to replace legacy reporting and bring in modern BI/Analytics to leverage Social, Cloud, Mobile, Big Data, Visualizations, and Predictive Analytics. For several world-class vendors, I led services teams specializing in providing software implementation and custom application development. Based on scores of successful engagements, I have assembled proven methodologies and automated software tools.

During twenty years of technical consulting, I have been blessed to work with smart people from some of the world's most respected organizations, including: FedEx, Procter & Gamble, Nationwide, The Wendy's Company, The Kroger Co., JPMorgan Chase, MasterCard, Bank of America Merrill Lynch, Siemens, American Express, and others.

I was educated at Valparaiso University and the University of Cincinnati, graduating summa cum laude. In 1990, I joined Information Builders, the vendor of WebFOCUS BI and iWay enterprise integration products, and for over a dozen years served in branch leadership roles. For several years, I also led technical teams within Cincom Systems' ERP software product group and the custom software services arm of Xerox.

Since 2007, I have provided enterprise BI services such as: strategic advice; architecture, design, and software application development of intelligence systems (interactive dashboards and mobile); data warehousing; and automated modernization of legacy reporting.