Displaying Superscripts On Data, Heading, and Footing Lines

How to:

Superscript characters are supported as a text style in text objects using HTML markup tags. The superscript markup tag is now supported in data columns, headings, and footings in HTML, PDF, PPTX, and PS output formats. Superscript values can be defined within the data, added to virtual fields, or added to text strings displayed in headings and footings.

In order to activate the translation of the HTML markup tags, in the StyleSheet set MARKUP=ON for any report component that will display superscripts. Without this attribute, the markup tags will be treated as text, not tags.

Note: For XLSX output format, you can use superscript functionality in headings and footings using STYLE=SUPERSCRIPT syntax. STYLE=SUPERSCRIPT syntax is ignored for all other output formats.

Syntax: How to Display Superscripts on Report Data, Heading, and Footing Lines

If the tags are not within the data itself, create a field that contains the text to be used as a superscript. Also, turn markup tags on for the components that will display superscripts:

  • In a DEFINE or COMPUTE command, define a field that contains the text to be displayed as a superscript.

    For a DEFINE FILE command, the syntax is:

    DEFINE FILE ...
    field/An = <sup>text</sup>;
    END

    For a COMPUTE command or a DEFINE in a Master File, the syntax is:

    {COMPUTE|DEFINE} field/An = <sup>text</sup>;

    where:

    n

    Is the length of the string defining the superscript, including the text to be used as the superscript and the opening and closing markup tags (<sup> and </sup>).

    text

    Is the text to be used as the superscript.

  • In the StyleSheet, set MARKUP=ON for any report component that will display superscripts:
    TYPE=component,MARKUP=ON ... ,$

    where:

    component

    Is one of the following report components: DATA, HEADING, FOOTING, SUBHEAD, SUBFOOT, TABHEADING, TABFOOTING.

Example: Displaying Superscripts in Data and Footing Lines in PDF Output

The following request against the GGSALES data source defines two fields that will display as superscripts. SUP1 and SUP2 consist of the numbers 1 and 2, respectively. SUPCOPY consists of a copyright symbol. Note that the difference is the syntax as defined for a text value as opposed to a HEX value.

The COMPUTE command compares sales dollars to budgeted dollars. If the value calculated is less than a minimum defined, the superscript SUP1 is concatenated after the category name. If the value is greater, SUP2 is concatenated.

The superscript SUPCOPY is used to display the copyright symbol in the footing of the report.

The footing concatenates the superscript fields in front of their explanations.

In the StyleSheet, every component that will display a superscript has the attribute MARKUP=ON.

DEFINE FILE GGSALES
SUP1/A12= '<SUP>1</SUP>';
SUP2/A15= '<SUP>2</SUP>';
SUPCOPY/A20= '<SUP>'||HEXBYT(169,'A2')||'</SUP>';
END
TABLE FILE GGSALES
SUM
COMPUTE PROFIT/D12CM=DOLLARS-BUDDOLLARS; NOPRINT
COMPUTE SHOWCAT/A100=IF PROFIT LE -50000 THEN CATEGORY || SUP1
       ELSE IF PROFIT GT 50000 THEN CATEGORY || SUP2
           ELSE CATEGORY; AS Category
BUDDOLLARS/D12CM
DOLLARS/D12CM
BY REGION 
BY CATEGORY NOPRINT
HEADING
"Analysis of Budgeted and Actual Sales"
FOOTING
""
"<SUP1 Dollar sales $50,000 less than budgeted amount."
"<SUP2 Dollar sales $50,000 greater than budgeted amount."
""
"Copyright<SUPCOPY 2012, by Information Builders, Inc " 
ON TABLE SET HTMLCSS ON
ON TABLE SET SQUEEZE ON
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=DATA,MARKUP=ON,$
TYPE=DATA,COLUMN=N5, COLOR=RED, WHEN=PROFIT LT -50000,$
TYPE=DATA,COLUMN=N6, COLOR=GREEN, WHEN=PROFIT GT 50000,$
TYPE=HEADING, JUSTIFY=LEFT,$
TYPE=FOOTING, MARKUP=ON, JUSTIFY=LEFT,$
TYPE=FOOTING, LINE=2,JUSTIFY=LEFT, COLOR=RED,$
TYPE=FOOTING, LINE=3,JUSTIFY=LEFT, COLOR=GREEN,$
ENDSTYLE
END

The output is:

Example: Displaying Superscripts in Heading and Footing Lines in XLSX Output

The following request against the GGSALES data source defines superscripts for trademark and copyright symbols in the heading and footing. COPYRIGHT consists of a copyright symbol. Note the STYLE = SUPERSCRIPT syntax in the heading and footing lines.

DEFINE FILE GGSALES
COPYRIGHT/A1= HEXBYT(169, 'A1');
END
TABLE FILE GGSALES
SUM UNITS BY CATEGORY 
HEADING
"Company-Trademark<+0>TM"
" "
"Company-Copyright<+0><COPYRIGHT" 
" "
FOOTING
"Company-Trademark<+0>TM"
" "
"Company-Copyright<+0><COPYRIGHT" 
" "
ON TABLE PCHOLD FORMAT XLSX
ON TABLE SET STYLE *
TYPE=HEADING, WRAP=OFF, $
TYPE=HEADING, LINE=1, ITEM=2, OBJECT=TEXT, STYLE='SUPERSCRIPT+BOLD+ITALIC', COLOR=RED, $ 
TYPE=HEADING, LINE=3, ITEM=1, OBJECT=FIELD, STYLE='SUPERSCRIPT+BOLD', COLOR=GREEN, $ 
TYPE=FOOTING, LINE=1, ITEM=2, OBJECT=TEXT, STYLE='SUPERSCRIPT+BOLD+ITALIC', COLOR=RED, $ 
TYPE=FOOTING, LINE=3, ITEM=1, OBJECT=FIELD, STYLE='SUPERSCRIPT+BOLD', COLOR=GREEN, $ 
ENDSTYLE
END

The output is shown in the following image.