STYLESHEET Exposed Bob Zinn WebFOCUS Specialist The University of North Carolina at Greensboro Agenda • • • Concepts of WebFOCUS StyleSheet Internal Cascading StyleSheet Identifying Selected Report Components – – – – – • • Columns Data Total and Subtotal Rows Column Titles Headings and Footings Conditional Styling Drill-Down Concepts • StyleSheet enables you to format and produce attractive reports that highlight key information. • StyleSheets allow you to specify various characteristics of your report and format report components individually. • StyleSheets may be internal or external to the report request – Internal - when you need to apply a StyleSheet to only one report – External - as a separate file. This enables you to apply one StyleSheet to multiple reports Concepts Use a StyleSheet to: • • • • • Format report individual components Incorporate graphical elements Format data that meets specified conditions Create dynamic hyperlinks Create macros that enable you to streamline your formatting specifications • Use external Cascading StyleSheets Internal CSS for HTML Reports • Internal Cascading Style Sheet are created with: ON TABLE SET HTMLCSS {ON|OFF} where: • ON - Generates an internal Cascading Style Sheet in the HTML report to control most aspects of the report's appearance. • OFF - No generation of an internal Cascading Style Sheet. Formatting tags are placed in each HTML table cell used to create the report. Internal CSS for HTML Reports • Improves performance by reducing the size of the HTML file which decreases transmission bandwidth. Result large reports display more quickly. • Provide more formatting options for your HTML report • Internal Cascading Style Sheets enable HTML support for the UNITS, BOTTOMMARGIN, TOPMARGIN, LEFTMARGIN, RIGHTMARGIN, SIZE, POSITION, WRAP, and PAGECOLOR attributes. • Enables addition and removal of underlines from most report components and specify the starting position and size of an image Sample Report TABLE FILE CAR PRINT COUNTRY ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE PCHOLD FORMAT HTML ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * UNITS=IN, LEFTMARGIN=0.500000, RIGHTMARGIN=0.500000, TOPMARGIN=0.500000, BOTTOMMARGIN=0.500000, SQUEEZE=ON, ORIENTATION=PORTRAIT, $ $ StyleSheet comment TYPE=REPORT, GRID=OFF, FONT='ARIAL', SIZE=9, COLOR='BLACK', BACKCOLOR='NONE', STYLE=NORMAL, TOPGAP=0.013889, BOTTOMGAP=0.027778, $ -* Dialogue Manager comment Sample Report TYPE=TITLE, STYLE=BOLD,$ TYPE=TABHEADING, SIZE=12, STYLE=BOLD,$ TYPE=TABFOOTING, SIZE=12, STYLE=BOLD,$ TYPE=HEADING, SIZE=12, STYLE=BOLD,$ TYPE=FOOTING, SIZE=12, STYLE=BOLD,$ TYPE=SUBHEAD, SIZE=10, STYLE=BOLD,$ TYPE=SUBFOOT, SIZE=10, STYLE=BOLD,$ TYPE=SUBTOTAL, BACKCOLOR=RGB(210 210 210),$ TYPE=ACROSSVALUE, SIZE=9,$ TYPE=ACROSSTITLE, STYLE=BOLD,$ TYPE=GRANDTOTAL, BACKCOLOR=RGB(210 210 210), STYLE=BOLD,$ ENDSTYLE END Identifying Report Section Identify the report section TYPE=section REPORT DATA TITLE TEXT ACROSSVALUE ACROSSTITLE UNDERLINE SKIPLINE PAGENUM HEADING SUBHEAD TABHEADING FOOTING SUBFOOT TABFOOTING RECAP SUBTOTAL GRANDTOTAL Identify Subtype – Additional attributes such as COLUMN, LINE, OBJECT, or ITEM, to identify a specific component. Identifying Attributes Identify report attributes ATTRIBUTE FONT SIZE COLOR BACKCOLOR PAGECOLOR STYLE JUSTIFY TITLETEXT GRID WRAP WHEN IMAGE BACKIMAGE BORDER POSITION BORDER has several formats: – BORDER [-POSITION] values include TOP, BOTTOM, LEFT, RIGHT – BORDER [-POSITION] –STYLE values include SOLID, DOUBLE, DASHED, DOTTED, etc – BORDER [-POSITION] –COLOR values include color or RGB(r g b) Identifying Subtype TYPE=REPORT, subtype=value Where subtype identifies: • COLUMN specifies – – – – a sort column (generated by BY), a display column (generated by PRINT, LIST, SUM, or COUNT) a computed column (generated by COMPUTE) a column of row totals (generated by ROW-TOTAL). • ACROSSCOLUMN specifies every instance of a column that is repeated across a horizontal sort (ACROSS) row. Identifying Subtype COLUMN=value Identifying report columns using values: • Nn - Identifies a column by its position in the report. To determine this value, count vertical sort (BY) fields, display fields, and ROWTOTAL fields, from left to right, including NOPRINT fields. • Pn - Identifies a column by its position in the report. To determine the value of n, count vertical sort (BY) fields, display fields, and ROWTOTAL fields from left to right. Do not count NOPRINT fields. • Cn - Identifies a display column by its position in the report. To determine the value of n, count only display fields from left to right. Identifying Subtype COLUMN=value • FIELD - Identifies a column by its field name. When a field occurs more than once, use field(n) to select a particular occurrence or field(*) to select all occurrences of the field. • ROWTOTAL - Identifies a column of row totals generated using ROW-TOTAL. When used with ACROSS and multiple display commands, ROWTOTAL generates multiple total columns. Use ROWTOTAL(n) to select a particular total column. Use ROWTOTAL(field) to select the row total column for a particular field. • Use ROWTOTAL(*) to select all row total columns in the report. Identifying Total or Subtotal Identify an Entire Total or Subtotal Row TYPE=section, [BY=sortcolumn] TYPE identifies a subtotal or total: • GRANDTOTAL - a grand total (generated by COLUMN-TOTAL, SUBTOTAL, SUB-TOTAL, RECOMPUTE, or SUMMARIZE). • SUBTOTAL - a subtotal (generated by SUBTOTAL, SUB-TOTAL, RECOMPUTE, or SUMMARIZE). • RECAP - a subtotal calculation (generated by ON sortfield RECAP or ON sortfield COMPUTE). BY=sortcolumn identifies the subtotal commands when there are multiple subtotal statements. Use either Bn or fieldname as the identifier. Identifying Data Identify All Data TYPE = DATA Identifies all report data except totals, grand totals, subtotals, and ACROSS values. Identify a Data Column TYPE=DATA, COLUMN=column Where column identifies the column. Example: TYPE=DATA, Size=10,$ Identifying Column Title Identify All Column Titles TYPE=TITLE Identify a Specific Column Title TYPE=TITLE, COLUMN=column Where column identifies a specific column title. Example: TYPE=TITLE, STYLE=BOLD+UNDERLINE,$ Identifying Heading or Footing TYPE=section, [BY=sortcolumn] TYPE=section identifies any of the following: – TABHEADING - report heading. Appears at the beginning of the report. Generated by ON TABLE SUBHEAD statement. – TABFOOTING - report footing. Appears at the end of the report. Generated by ON TABLE SUBFOOT statement. – HEADING - page heading. Appears at the top of each report page. Generated by HEADING statement. – FOOTING - page footing. Appears at the bottom of each report page. Generated by FOOTING statement. – SUBHEAD - sort heading. Appears at the beginning of a BY sort group. Generated by ON sortfield SUBHEAD statement. – SUBFOOT - sort footing. Appears at the end of a BY sort group. Generated by ON sortfield SUBFOOT statement. Identify Heading or Footing Objects Identify a Object in a Heading or Footing TYPE=type, [LINE=line_number], [OBJECT=[TEXT,FIELD], [ITEM=item_number] TYPE=type identifies TABHEADING, TABFOOTING, HEADING, FOOTING, SUBHEAD, SUBFOOT. Note: LINE, OBJECT, and ITEM are optional LINE=line identifies a line by its position. Only need when specific identification is required. OBJECT=TEXT,FIELD identifies the object as text or a field. ITEM=item identifies an item by its position in a line. Heading With Line and Object TABLE FILE CAR "Vehicle <+0>Profile <+0>Per <+0>Country" "<COUNTRY" SUM DCOST RCOST COMPUTE MARGIN/D6.2% = RCOST/DCOST*100; BY COUNTRY PAGE-BREAK BY CAR ON TABLE SET STYLE * TYPE=HEADING, LINE=1, OBJECT=TEXT, ITEM=3, COLOR=RED, STYLE=BOLD,$ TYPE=HEADING, LINE=2, STYLE=BOLD,COLOR=BLUE,$ END Heading With Line and Object Conditional Styling DEFINE FILE CAR PROFIT/D9.2 = RCOST-DCOST; END TABLE FILE CAR HEADING "Vehicle Profit" " " SUM DCOST RCOST PROFIT -*COMPUTE PROFIT/D9.2 = RCOSTDCOST; BY HIGHEST PROFIT NOPRINT BY COUNTRY BY CAR BY MODEL ON TABLE SET BYDISPLAY ON ON TABLE SET PAGE-NUM OFF ON TABLE SET STYLESHEET * TYPE=REPORT, GRID=OFF, $ TYPE=DATA, BACKCOLOR=AQUA, STYLE=BOLD, WHEN=PROFIT GT 5000, $ TYPE=DATA, BACKCOLOR=YELLOW, STYLE=BOLD, WHEN=PROFIT GT 2000, $ TYPE=DATA, BACKCOLOR=PINK, STYLE=ITALIC, WHEN=PROFIT LT 1000, $ TYPE=DATA, COLUMN=C3, BACKCOLOR=AQUA, COLOR=RED, STYLE=BOLD+ITALIC, WHEN=PROFIT GT 6 000, $ TYPE=DATA, BACKCOLOR=SILVER, FONT='Arial', $ TYPE=HEADING, FONT='Arial', STYLE=BOLD, SIZE=11, $ ENDSTYLE END Conditional Styling Drill-Down Example TABLE FILE CAR "Bob's Auto Sales" SUM DEALER_COST/D10.2!e RETAIL_COST/D10.2!e SALES/D12.2!e BY COUNTRY BY CAR BY MODEL ON TABLE SET ONLINE-FMT HTML ON TABLE SET PAGE OFF ON TABLE SET STYLE * TYPE=DATA,COLUMN=MODEL,FONT='ARIAL', COLOR='RED',FOCEXEC=CARDRLL2(VAR=MODEL),TARGET='_blank',$ TYPE=DATA, BACKCOLOR=('WHITE' RGB(210 210 210)),$ alternate background TYPE=HEADING, IMAGE=carlogo.gif,$ TYPE=HEADING, OBJECT=TEXT, STYLE=BOLD, SIZE=24,$ ENDSTYLE END Drill-Down Example Drill-Down Example TABLE FILE CAR PRINT COUNTRY CAR MODEL SEG.BODYTYPE WHERE MODEL EQ '&VAR'; END Drill-Down Example StyleSheet Exposed Summary • Understanding the StyleSheet command allows for display control of the report • Additional details may be found in the WebFOCUS Creating Reports Manual • Experiment