Special Symbols in WebFOCUS
by David Beagan
A WebFOCUS customer wanted to enable its report writers to easily include special symbols in the headers and footers of report outputs. The symbols of interest included copyright, trademark, registered trademark, British Pound, Euro, Japanese Yen and degree symbols.
The usual techniques for inserting special characters into a report are not obvious, and the customer wanted something that was comprehensive and simple to use. Being comprehensive meant allowing any of the symbols to be placed in report headings and footings, and to be used in defines and computes for display as part of report data.
Simple to use meant the report writer could easily use standard tools such as Report Painter of Report Assistant to put the symbols into their reports in a very straightforward manner. And, ideally, the solution would be applicable to different output formats such as HTML, PDF, and Excel. As it turns out, the character codes for special characters in HTML output format differ from that of PDF.
The HEXBYT function can be used to create any character, but this places a burden on the report writer. The particular code for the character in question must be discovered. Also, the proper syntax and parameter specification for the HEXBYT function must be known.
The approach outlined here handles all of this using a standard WebFOCUS -INCLUDE file called symbols.fex. It is written to work in conjunction with the standard WebFOCUS parameter variable name, &WFFMT. This is the parameter variable that is used when a report is created with Report Painter and the output format selected is "user." This standard parameter variable is placed in the report code where the output format is normally specified. Then the report is ready to receive output format specification from a parameter page, or drill down from another program.
The report procedure in which the special symbols are to appear merely needs to have the symbols.fex included in the beginning of the reporting procedure. At report run time, based on the value of &WFFMT that has been passed to the reporting procedure, symbols.fex sets the proper code for each of the special symbols
it supports.
With the INCLUDE for symbols.fex in place, the report writer using Report Painter will see each of the variables listed under the external variables section of Object Inspector, making it easy to include the variable name for the special symbol into a header or footer.
For COMPUTES, the variables are listed under external variables in the Insert field window. For any of these situations for defined fields the variable can be simply typed in. When creating defines or computes containing one of the symbols, allow seven characters for the symbol. For example, to assign just the copyright symbol to a field, the format of the field should be A7. The symbols.fex uses the following variable names for the special symbols:
&Degree Degree
&Bullet Bullet
&Copyright Copyright
&RegTrademark Registered Trademark
&Trademark Trademark
&Euro Euro
&Yen Japanese Yen
&Pound British Pound
The particular names given the variables are arbitrary; choose whichever you like. Also, the list of special symbols supported by the include file can be extended to whatever an organization needs.
The symbols.fex follows:
-* File symbols.fex
-DEFAULT &WFFMT = 'HTML';
-SET &Degree = IF &WFFMT EQ 'HTML' THEN '&'|'#0176;' ELSE HEXBYT(176, 'A1');
-SET &Bullet = IF &WFFMT EQ 'HTML' THEN '&'|'#8226;' ELSE HEXBYT(127, 'A1');
-SET &Copyright = IF &WFFMT EQ 'HTML' THEN '&'|'#0169;' ELSE HEXBYT(169, 'A1');
-SET &RegTradmark = IF &WFFMT EQ 'HTML' THEN '&'|'#0174;' ELSE HEXBYT(174, 'A1');
-SET &Trademark = IF &WFFMT EQ 'HTML' THEN '&'|'#8482;' ELSE HEXBYT(153, 'A1');
-SET &Euro = IF &WFFMT EQ 'HTML' THEN '&'|'#8364;' ELSE HEXBYT(128, 'A1');
-SET &Yen = IF &WFFMT EQ 'HTML' THEN '&'|'#0165;' ELSE HEXBYT(165, 'A1');
-SET &Pound = IF &WFFMT EQ 'HTML' THEN '&'|'#0163;' ELSE HEXBYT(163, 'A1');
|