WebFOCUS 8: Dynamic Content
By Matthew Lerner
A challenge you may have faced when working with WebFOCUS is matching the styling of your output (reports, charts, documents, etc.) to the location where you deploy them. This location may have been our Business Intelligence Dashboard or your own application. You also may have run into an issue with sizing of charts.
Both problems are easily solvable when the person designing the application is the same person building the content. In the case of the styling you would build a matching STY file to your application look. As for chart sizing, you would go back and forth until you get it just right. None of this is too bad if the output were only used in a single application.
However, if you wanted to deploy the same report in multiple applications, you either code Dialogue Manager to conditionally style the report or you maintain multiple copies of the report. As for the chart, you may have parameterized the size and written your own code to handle this. Or perhaps you keep multiple copies. Solving these problems is not fun and keeps you from solving more important issues.
WebFOCUS 8 solves both of these problems for you. When using the Business Intelligence Portal, each portal theme has a style sheet associated with it. You can choose a different sheet or even disable dynamic styling, both at the portal level or for an individual piece of output. Screens 1 and 2 show the same report dynamically styled in the Information Builders portal theme and the “purple” portal theme. As you can see, the reports match the portal without any special logic in the reports themselves.

Screen 1

Screen 2
The way this works is that when the BI Portal runs, it passes the path to a STY file as part of the request in the variable WF_STYLE. In WebFOCUS 8, you can use this in the BI Portal or you can even pass WF_STYLE in your own application. If WF_STYLE=file.sty, then file.sty must be on your Reporting Server in the server’s APP PATH.
If WF_STYLE contains an IBFS path such as WF_STYLE=IBFS://WFC/Repository/Retail/retail.sty, the style sheet referenced will be sent to the Reporting Server to be used in place of any INCLUDE= references in the procedure. Any explicit styling in the procedure will be maintained, but the INCLUDE will be done dynamically by the application.
Sizing of charts can be done in a similar fashion using the chart AutoFit feature. This feature does require some special code in the chart. Fortunately, InfoAssist takes care of this for you. In WebFOCUS 8, the Layout tab in InfoAssist allows you to set the height and width of your chart (Screen 3). By default, it also enables the AutoFit feature. When enabled, instead of hard-coding the height and width, it parameterizes them. In addition, it parameterizes the units.

Screen 3
Prior to WebFOCUS 8, the code for the height, width, and units would read:
ON GRAPH SET HAXIS 770.0 ON GRAPH SET VAXIS 405.0 ON GRAPH SET UNITS PIXELS
With AutoFit turned on, it reads:
ON GRAPH SET HAXIS &WF_STYLE_WIDTH ON GRAPH SET VAXIS &WF_STYLE_HEIGHT ON GRAPH SET UNITS &WF_STYLE_UNITS
In addition, InfoAssist issues default values at the top of the procedure in case these variables are not passed in:
-DEFAULTH &WF_STYLE_UNITS='PIXELS'; -DEFAULTH &WF_STYLE_HEIGHT='405.0'; -DEFAULTH &WF_STYLE_WIDTH='770.0';
DEFAULTH is used to stop auto prompt from asking for values. If the calling application passes values, then those are used. If not, the defaults are used.
The BI Portal passes the height and width of the container as well as the unit of PIXELS on every request. This is illustrated on Screens 4 and 5. The same chart is run with the container at different sizes and, as a result, the chart is sized bigger on Screen 5.

Screen 4

Screen 5
Dynamic report styling and chart AutoFit should really make it easier for you to build your applications. End users can use InfoAssist to build their content without worrying about how it will fit into the BI Portal. While we covered the technical details in this article, all you really need to know is that it works. Build your content once and deploy it everywhere, without any special coding on your part.