EXL2K format generates styled reports in Excel 2000 HTML format for use on other platforms and on the Web. Feature options enable FOCUS users to also download all fields mentioned in their requests in an Excel PivotTable, or include interactive Excel formulas for FOCUS aggregation operations for performing additional "what if" analyses on their data within Excel 2000.
EXL97 is an HTML-based HOLD format for generating formatted Excel 97 spreadsheets. EXL97 is a full StyleSheet driver for accurately rendering all report elements (such as headings and subtotals, for example) as well as applying StyleSheet syntax (such as, conditional styling). You must have Microsoft Excel 97 or higher installed on your computer to display an Excel 97 report.
How to: |
EXL2K format is a full StyleSheet driver for accurately rendering all report elements (such as headings and subtotals) as well as applying StyleSheet syntax (such as, conditional styling). The EXL2K format accurately displays formatted dates and numeric values and controls column width and wrapping in Excel 2000.
The three HOLD format options for Excel 2000 are:
[ON TABLE] HOLD [AS filename] FORMAT EXL2K [PIVOT] [FORMULA]
where:
Creates an Excel-formatted output file that may include styling based on internal or external StyleSheets features. The file type on VM is XHT; the extension on Windows platforms is .xht;
Creates an output file in Excel PivotTable format with an accompanying PivotTable cache file. The filetype of the Pivot Table file is XML; the extension on Windows platforms is .xml. For more information about this option, see Using the Excel 2000 PIVOT Option .
Creates an XHT output file including appropriate Excel formulas for all FOCUS numeric summary operations. For more information about this option, see Using the Excel 2000 Formula Option.
This example shows how to create a styled report in EXL2K format, with conditional styling based on the contents of CENTORD:
TABLE FILE CENTORD HEADING "LINE COST BY STATE" SUM LINE_COGS AS 'Cost' BY STATE AS 'State' BY PLANTLNG AS 'Plant' BY STORENAME AS 'Store Name' WHERE TOTAL LINE_COGS GT 10000000 ON TABLE HOLD AS EXL2K1 FORMAT EXL2K ON TABLE SET STYLE * TYPE=REPORT, FONT=ARIAL, TITLETEXT=SALES REPORT, $ TYPE=DATA, COLUMN=LINE_COGS, COLOR=RED, BACKCOLOR=YELLOW, WHEN=LINE_COGS GT 20000000,$ TYPE=DATA, COLUMN=STORENAME, BACKCOLOR=YELLOW, WHEN=LINE_COGS GT 20000000,$ TYPE=HEADING, FONT=ARIAL BLACK, COLOR=RED, BACKCOLOR=SILVER, SIZE=16, $ TYPE=TITLE, FONT=ARIAL, SIZE=12, $ ENDSTYLE END
The output is:
You can also adjust column contents in your Excel spreadsheets using the StyleSheets keywords WRAP (for wrapping column contents) and SQUEEZE (for truncating columns).
How to: |
Excel 2000 users can select one of six languages as their default language when generating EXL2K formatted output. In addition to English, which is the automatic default, users can issue a SET command to select one of five other options.
Excel 2000 users can select one of six languages as their default language when generating EXL2K formatted output. In addition to English, which is the automatic default, you can select one of five other options
SET EXL2KLANG=lang
where:
Is one of the following: AME, FRE, SPA, GER, JPN or KOR.
You can code the SET EXL2KLANG in your user profile or include it in a FOCEXEC to override the default setting in the NLSCFG ERRORS file for a specific request.
Reference: |
When translating numeric and date formats from FOCUS to Excel, there must be a corresponding Excel format to translate to. If there is no corresponding format, then the value will be formatted in the closest matching Excel format or in Excel's General format.
Excel 2000 spreadsheets generated by FOCUS contain the numeric formatting specified in the data source Master File or as specified in a temporary field. All FOCUS numeric values and date formats (such as currency and Smart Dates) are translated into supported Excel formats and display properly in Excel 2000.
This example illustrates how formatted numeric data appears in a spreadsheet when you use the EXL2K format. Note that the format for the LINEPRICE field D12.2M (that represents floating point double-precision with two decimal places, commas, and a floating dollar sign) is translated into the corresponding Excel format.
SET PAGE-NUM=OFF TABLE FILE CENTORD "Line Total Report" "Excel 2000 Spreadsheet" " " SUM LINEPRICE BY STATE AS 'State' BY PLANTLNG AS 'Plant' BY STORENAME AS 'Store Name' WHERE TOTAL LINEPRICE FROM 9000000 TO 20000000 ON TABLE SET BYDISPLAY ON ON TABLE HOLD AS EXL2K2 FORMAT EXL2K ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF, FONT=TAHOMA, $ TYPE=HEADING, SIZE=14, COLOR=NAVY, $ TYPE=HEADING, LINE=2, SIZE=12, COLOR=RED, $ TYPE=TITLE, JUSTIFY=CENTER, STYLE=BOLD, $ TYPE=DATA, JUSTIFY=CENTER, $ TYPE=DATA, COLUMN=LINEPRICE, JUSTIFY=RIGHT, $ END
The output is:
Note the repetition of the sort field values in the output. This presentation is particularly desirable in a spreadsheet and is controlled by the command ON TABLE SET BYDISPLAY ON.
This example illustrates how customized dates display in a spreadsheet when using the EXL2K format.
Month Hired is defined in the request as MtYY format (the month is represented as a three-character abbreviation with an initial capital letter followed by a four-digit year).
Years of Service is defined as I4C format, a four-digit integer with a comma if required. Both formats are properly displayed as defined in the spreadsheet.
SET PAGE-NUM=OFF DEFINE FILE EMPLOYEE YRHIRED/YY = HIRE_DATE; MHIRED/MtYY = HIRE_DATE; TOTSVC/I4C = 2002 - YRHIRED; END TABLE FILE EMPLOYEE "Employee Service Report for 2002" "Excel 2000 Spreadsheet" " " PRINT FIRST_NAME AS 'First Name' MHIRED AS 'Month Hired' TOTSVC AS 'Years of Service' BY LAST_NAME AS 'Last Name' ON TABLE SET BYDISPLAY ON ON TABLE HOLD AS EXL2K3 FORMAT EXL2K ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF, FONT=TAHOMA, $ TYPE=HEADING, SIZE=14, COLOR=NAVY, $ TYPE=HEADING, LINE=2, SIZE=12, COLOR=RED, $ TYPE=TITLE, JUSTIFY=CENTER, STYLE=BOLD, $ TYPE=DATA, JUSTIFY=CENTER, $ TYPE=DATA, COLUMN=TOTSVC, COLOR=BLUE, WHEN=TOTSVC GT 20, $ END
The output is:
The command ON TABLE SET BYDISPLAY ON ensures that sort fields are repeated in each spreadsheet cell.
Warning: The following formats are not supported in EXL2K and may produce unpredictable results when translated into Excel's General Format:
The following applies to headings and footings with embedded numeric fields:
How to: |
You control data wrapping and column widths in FORMAT EXL2K, by:
TYPE=REPORT, [COLUMN=column,] WRAP=value, $
where:
Identifies a particular column. If COLUMN is not included in the declaration, the column width specified with SQUEEZE is applied to the entire report.
Is one of the following:
Turns on data wrapping. ON is the default. With this setting, the column width is determined by the client (Excel). Data wraps if it exceeds the width of the column and the row’s height expands to meet the new height of the wrapped data.
Turns off data wrapping. This setting adjusts the column width of the largest data value in the column. Data will not wrap in any cell in the column.
Represents a specific numeric value for the column width. The value represents the measure specified with the UNITS parameter (the default is inches). This is the most commonly used SQUEEZE setting in an Excel 2000 report.
TYPE=REPORT, [COLUMN=column,] SQUEEZE=n, $
where:
Identifies a particular column. If COLUMN is not included in the declaration, the column width specified with SQUEEZE is applied to the entire report.
Represents a specific numeric value for the column width. The value represents the measure specified with the UNITS parameter (the default is inches). This is the most commonly used SQUEEZE setting in an Excel 2000 report.
Note: SQUEEZE=(ON/OFF), which turns data wrapping on and off, is not supported for EXL2K, so if a data value is wider than the specified column width, it will be hidden from view. However, you can adjust column widths in Excel after you generate a spreadsheet.
The following example illustrates how to turn on and turn off data wrapping in a column and how to set the column width for a particular column. The UNITS in this example are set to inches (the default).
DEFINE FILE CENTORD MYDATE/MDY='10/22/60'; RCD/D14.3=LINE_COGS; VERYLONG/A80='Multiply quantity times line_cost to'| ' calculate line_cost_of_goods'; END TABLE FILE CENTORD SUM MYDATE RCD VERYLONG AS 'Default' VERYLONG AS 'WRAP=OFF' VERYLONG AS 'WRAP=4.1' VERYLONG AS 'WRAP=2' VERYLONG AS 'SQUEEZE=2' LINE_COGS BY REGION AS 'Region' ON TABLE HOLD AS EXL2K4 FORMAT EXL2K ON TABLE SET STYLE * TYPE=DATA, COLUMN=MYDATE, JUSTIFY=CENTER, $ 1. TYPE=REPORT, COLUMN=VERYLONG(2), WRAP=OFF, $ 2. TYPE=REPORT, COLUMN=VERYLONG(3), WRAP=4.1, $ 3. TYPE=REPORT, COLUMN=VERYLONG(4), WRAP=2, $ 4. TYPE=REPORT, COLUMN=VERYLONG(5), SQUEEZE=2, $ END
where:
Note: The column titled "Default" illustrates the default column width and wrapping behavior.
Since the output is wider than this page, it is shown in two sections. The following output displays the "Default", "WRAP=OFF", and "WRAP=4.1" columns:
The following output displays the "WRAP=2", and "SQUEEZE=2" columns:
The StyleSheet options ORIENTATION=LANDSCAPE and BORDER=ON are supported for EXL2K report output.
The BORDER attribute supports the same options as available for FORMAT PDF except for the following border options:
Note: FORMAT EXL2K does not support the GRID=ON parameter.
The following report against the EMPLOYEE data source makes the orientation landscape and specifies dotted red borders:
TABLE FILE EMPLOYEE PRINT ACCTNUMBER AS 'Account Number' AND COMPUTE LAST3_ACCT/I3L = IMOD(ACCTNUMBER, 1000, LAST3_ACCT); BY LAST_NAME AS 'Last Name' BY FIRST_NAME AS 'First Name' WHERE (ACCTNUMBER NE 000000000) AND (DEPARTMENT EQ 'MIS'); ON TABLE HOLD FORMAT EXL2K FORMULA ON TABLE SET STYLE * TYPE=REPORT, ORIENTATION=LANDSCAPE,BORDER=ON, BORDER-COLOR=RED,BORDER-STYLE=DOTTED,$ TYPE=TITLE, SIZE=12, STYLE=BOLD, $ END
The output is:
How to: |
Using StyleSheet attributes, you can lock Excel spreadsheet values so they are read-only. These attributes apply to all Excel formats including EXL2K, EXL2K PIVOT, and EXL2K FORMULA.
To enable locking, use the following attributes:
TYPE=REPORT, PROTECTED={ON|OFF}, [LOCKED={ON|OFF}],$
where:
Is necessary to enable spreadsheet locking. PROTECTED=OFF is the default. If you omit the LOCKED=OFF attribute, the entire spreadsheet is locked.
Locks the entire spreadsheet. ON is the default value.
Unlocks the spreadsheet as a whole, but enables you to lock or unlock specific cells or groups of cells.
Once you include the following declaration in your StyleSheet, you can specify the LOCKED attribute for specific cells or groups of cells:
TYPE=REPORT, PROTECTED=ON, LOCKED=OFF,$
To lock specific parts of the spreadsheet, add the LOCKED=ON attribute to the StyleSheet declaration for the cells you want to lock.
TYPE=type, [ COLUMN=columnspec ] ,LOCKED={ON|OFF},$
where:
Is the type of element that describes the cells to be locked.
Is a valid column specification.
The following request locks the entire spreadsheet because the StyleSheet declarations include the following declaration:
TYPE=REPORT, PROTECTED=ON, $
The request is:
TABLE FILE CAR HEADING "Profit By Car " " " SUM RETAIL_COST AND DEALER_COST AND COMPUTE PROFIT/D12.2 = RETAIL_COST - DEALER_COST; BY CAR ON TABLE SET PAGE-NUM OFF ON TABLE PCHOLD AS EXLFORM1 FORMAT EXL2K ON TABLE SET STYLE * TYPE=REPORT, COLOR=BLUE, BACKCOLOR=SILVER, SIZE=9,$ TYPE=REPORT, PROTECTED=ON, $ TYPE=HEADING, STYLE=BOLD, SIZE=14, $ TYPE=TITLE, STYLE=BOLD, SIZE=11,$ ENDSTYLE END
You cannot edit any value on the spreadsheet. Any attempt to do so displays a message that the sheet is protected:
The following request locks the second column (RETAIL_COST) because the StyleSheet declarations include the following declarations
TYPE=REPORT, PROTECTED=ON, LOCKED=OFF, $ TYPE=DATA, COLUMN=2, LOCKED=ON,$
The request is:
TABLE FILE CAR HEADING "Profit By Car " " " SUM RETAIL_COST AND DEALER_COST AND COMPUTE PROFIT/D12.2 = RETAIL_COST - DEALER_COST; BY CAR ON TABLE SET PAGE-NUM OFF ON TABLE PCHOLD AS EXLFORM2 FORMAT EXL2K ON TABLE SET STYLE * TYPE=REPORT, COLOR=BLUE, BACKCOLOR=SILVER, SIZE=9,$ TYPE=REPORT, PROTECTED=ON, LOCKED=OFF,$ TYPE=HEADING, STYLE=BOLD, SIZE=14, $ TYPE=TITLE, STYLE=BOLD, SIZE=11,$ TYPE=DATA, COLUMN=2, LOCKED=ON,$ ENDSTYLE END
You cannot edit any value in column 2, although you can edit values in other columns. Any attempt to edit a value in column 2 displays a message that the cells are protected:
How to: Reference: |
Since Excel users employ formulas to calculate the contents of spreadsheet cells, the EXL2K feature includes a HOLD option for generating correct native Excel formulas for all FOCUS summary operations, such as row and column totals and COMPUTE commands. The EXL2K StyleSheet-related features can also be applied with the FORMULA option.
When you display or save a tabular report request using EXL2K FORMULA, the resulting spreadsheet contains correct native Excel formulas that compute and display the results of all aggregation operations (such as row totals, column totals, subtotals, and calculated values) rather than the static values. Spreadsheets saved using the EXL2K FORMULA format are interactive, allowing for "what if" scenarios that immediately reflect any additions or modifications made to the data.
The EXL2K FORMULA format is supported for the following FOCUS TABLE options: ROWTOTAL, COLUMN-TOTAL, SUB-TOTAL, SUBTOTAL, SUMMARIZE, RECOMPUTE, and COMPUTE, and for calculations performed by functions.
EXL2K FORMULA is not supported with PivotTables (EXL2K PIVOT), with prefix operators, or with financial reports created with the Financial Modeling Language (FML).
Add the following syntax to your request to include Excel formulas in your spreadsheet:
ON TABLE HOLD FORMAT EXL2K FORMULA
The following example illustrates the translation of a column total in a report request into an Excel formula when using format EXL2K FORMULA. Note that the formatting of the column total (TYPE=GRANDTOTAL) is retained in the Excel 2000 spreadsheet.
When you select the total in the report, the equation =SUM(B4:B7) appears in the formula bar, representing the column total as a sum of cell ranges.
TABLE FILE CENTORD HEADING "Projected Return By Region" " " SUM LINE_COGS AS 'RETURN' BY REGION AS 'REGION' ON TABLE COLUMN-TOTAL ON TABLE HOLD AS EXL2K5 FORMAT EXL2K FORMULA ON TABLE SET STYLE * TYPE=REPORT, COLOR=BLUE, BACKCOLOR=SILVER, SIZE=9,$ TYPE=HEADING, STYLE=BOLD, SIZE=14,$ TYPE=TITLE, STYLE=BOLD+UNDERLINE, SIZE=10,$ TYPE=GRANDTOTAL, STYLE=BOLD,$ ENDSTYLE END
The output is:
This request calculates totals for line price and quantity across regions. The row totals are represented as sums of cell ranges.
TABLE FILE CENTORD HEADING "Projected Line Cost Across Region" " " SUM LINEPRICE AND QUANTITY ACROSS REGION AS 'Region' BY STORENAME WHERE REGION EQ 'EAST' OR 'NORTH' ON REGION ROW-TOTAL AS 'TOTAL' ON TABLE COLUMN-TOTAL AS 'TOTAL' ON TABLE HOLD AS EXL2K6 FORMAT EXL2K FORMULA ON TABLE SET STYLE * TYPE=REPORT, COLOR=BLUE, BACKCOLOR=SILVER, SIZE=9,$ TYPE=HEADING, STYLE=BOLD, SIZE=14,$ TYPE=TITLE, STYLE=BOLD, SIZE=11,$ TYPE=SUBTOTAL, STYLE=BOLD, $ TYPE=GRANDTOTAL, STYLE=BOLD, SIZE=11,$ TYPE=ACROSSTITLE, STYLE=BOLD, SIZE=11, JUSTIFY=LEFT,$ TYPE=ACROSSVALUE, STYLE=BOLD, SIZE=10, JUSTIFY=CENTER,$ ENDSTYLE END
The output highlights the formula that calculates the row total in cell G11=C11+E11:
This request totals the columns for line price and quantity and calculates the value of a field called LINECOST by multiplying the line price by the quantity.
The formula for the calculated values is generated by translating the internal form of the FOCUS expression (COMPUTE LINECOST/P24.2MC=QUANTITY*LINEPRICE;) into an Excel formula.
TABLE FILE CENTORD ON TABLE SET PAGE-NUM OFF SUM LINEPRICE AND QUANTITY AS 'Quantity' COMPUTE LINECOST/P24.2MC = QUANTITY * LINEPRICE; AS 'Total Cost' BY REGION AS 'Region' HEADING "Line Cost of Goods by Region" " " ON TABLE COLUMN-TOTAL ON TABLE HOLD AS EXL2K7 FORMAT EXL2K FORMULA ON TABLE SET STYLE * TYPE=REPORT, COLOR=BLUE, BACKCOLOR=SILVER, SIZE=9,$ TYPE=HEADING, STYLE=BOLD, SIZE=14,$ TYPE=TITLE, STYLE=BOLD, SIZE=11,$ TYPE=GRANDTOTAL, STYLE=BOLD, SIZE=11,$ ENDSTYLE END
The top line in the spreadsheet output highlights the formula.
The following illustrates how functions are translated to Excel 2000 reports. The function IMOD divides ACCTNUMBER by 1000 and returns the remainder to LAST3_ACCT. The Excel formula corresponds to this, =(MOD($C2,1000)).
TABLE FILE EMPLOYEE PRINT ACCTNUMBER AS 'Account Number' AND COMPUTE LAST3_ACCT/I3L = IMOD(ACCTNUMBER, 1000, LAST3_ACCT); BY LAST_NAME AS 'Last Name' BY FIRST_NAME AS 'First Name' WHERE (ACCTNUMBER NE 000000000) AND (DEPARTMENT EQ 'MIS') ON TABLE HOLD AS EXL2K8 FORMAT EXL2K FORMULA ON TABLE SET STYLE * TYPE=TITLE, SIZE = 12, STYLE=BOLD,$ END
The output is:
How to: Reference: |
The power of EXL2K format derives in large measure from its ability to take advantage of PivotTables. PivotTables are Microsoft Excel tools for analyzing complex data. They allow you to drag and drop data fields within a PivotTable spreadsheet, providing different views of the data, such as sorting across rows or columns. You can also create dimensional hierarchies by using the PAGEFIELDS option.
When you use FORMAT EXL2K PIVOT, two data streams are created:
After creating FOCUS reports formatted as Excel PivotTables you must transfer both the XHT and XML files to Excel 2000 using FTP in ASCII mode or another transfer facility.
ON TABLE HOLD FORMAT EXL2K PIVOT AS mypivot
where:
Is a name you assign to the HOLD file.
Two files are generated with this syntax:
Standard HOLD and SAVE syntax is supported for EXL2K PIVOT. The PivotTable cache file contains all the fields specified in the procedure and links internally to the PivotTable file. All available fields can be viewed in the PivotTable toolbar.
Keep these considerations in mind when preparing output for a PivotTable:
This simple example shows how to populate and generate PivotTables:
TABLE FILE CENTINV HEADING "CENTINV File PivotTable" "Sum of Price by Product Across Category" PRINT PRICE BY PROD_NUM ACROSS PRODCAT ON TABLE COLUMN-TOTAL ON TABLE HOLD AS EXL2K9 FORMAT EXL2K PIVOT PAGEFIELDS PRODNAME CACHEFIELDS COST QTY_IN_STOCK ON TABLE SET STYLE * TYPE=HEADING, LINE=1, FONT='ARIAL', COLOR=PURPLE, SIZE=16, STYLE=BOLD,$ TYPE=HEADING, LINE=2, FONT='ARIAL', COLOR=PURPLE, SIZE=12, STYLE=BOLD,$ TYPE=DATA, FONT='ARIAL', COLOR=PURPLE,$ TYPE=GRANDTOTAL, FONT='ARIAL', COLOR=PURPLE, SIZE=12, STYLE=BOLD,$ ENDSTYLE END
The output is:
The PivotTable is generated by the PRINT command in combination with the BY, ACROSS, PAGEFIELDS, and CACHEFIELDS phrases. It contains all options used to design and format the report, as well as fields specified in the PIVOT request. Fields can be dragged into the report from the toolbar. The following graphic and summary table depicts PivotTable output with major elements and associated FOCUS syntax.
This table summarizes the effects of TABLE request syntax elements within EXL2K PIVOT operations. You must include at least one sort field or a PAGEFIELD to have a valid Pivot Table request.
Syntax Element |
Usage |
Effect on PivotTable |
---|---|---|
|
Required |
Designates the data field in a PivotTable. |
BY |
Optional |
Designates row field in a PivotTable. |
ACROSS |
Optional |
Designates a column field in a PivotTable. |
CACHEFIELDS |
Optional |
Places fields in the Pivot cache file and makes them available from the Pivot toolbar. |
PAGEFIELDS |
Optional |
Designates a Page field in a PivotTable. |
PivotTable Element |
Contains... |
Function |
Generating Syntax |
---|---|---|---|
Page field |
Field that controls view of the entire page (worksheet). |
A filtering mechanism to conduct a high level sort. |
PAGEFIELDS phrase |
Page field item |
The value for a page field item appears in a drop-down list. |
Selecting a page field item summarizes data for the entire report. |
PAGEFIELDS phrase |
Data field |
Numeric data that is available to be summarized |
Holds data available to be summarized |
PRINT command |
Column field |
Horizontal sort data |
Sorts data horizontally. |
ACROSS command |
Row field |
Vertical sort data |
Sorts data vertically. |
BY command |
Reference: |
By including a CACHEFIELDS phrase in your EXL2K request, you can add fields to the pivot cache not initially displayed in the report. The cache file enables you to add available fields from the PivotTable toolbar into the body of the PivotTable by dragging and dropping. You can also remove fields from the PivotTable by dragging and dropping them outside the report. In either case, you can very quickly vary your data views.
The CACHEFIELDS phrase is optional; you can always generate a PivotTable without one.
Fields designated as CACHEFIELDS must immediately follow the PIVOT keyword in the ON TABLE HOLD FORMAT EXL2K PIVOT syntax or follow a PAGEFIELDS phrase. A CACHEFIELD cannot be designated elsewhere in the request. Lists of CACHEFIELDS are terminated by the same keywords that terminate normal report requests, such as END or another ON phrase.
This example shows how to specify CACHEFIELDS to populate the PivotTable toolbar.
TABLE FILE CENTINV HEADING "PivotTable with CACHEFIELDS" "Sum of Price by Product Across Category" PRINT PRICE BY PRODCAT BY PRODTYPE ON PRODCAT SUB-TOTAL ON TABLE HOLD AS EXL2K10 FORMAT EXL2K PIVOT CACHEFIELDS COST PRODNAME ON TABLE SET STYLE * TYPE=DATA, COLUMN=PRODCAT, COLOR=RED,$ TYPE=HEADING, COLOR=BLUE, STYLE=BOLD, SIZE=14,$ ENDSTYLE END
The output is:
You can specify fields in the procedure as Excel 2000 page fields. Page fields filter the data for the field value specified. Through PivotTable functionality, you can select a single value from the page field drop-down menu (also called a page field item) to display only data associated with that selection. For example, in a report showing international car sales data, if you specify COUNTRY as your page field and JAPAN as the page field item, you will display only sales data for Japanese cars. If you then select ENGLAND, you will see the data for JAGUAR and TRIUMPH.
A page field can act as the sort field. Valid PivotTables can be generated without specifying a PAGEFIELD if sorting is handled by either a BY or ACROSS phrase. However, if the request contains neither a BY or ACROSS phrase, a PAGEFIELD must be included.
Note:
This example illustrates the use of PAGEFIELDS syntax to make three fields available in the PivotTable toolbar.
TABLE FILE CENTINV HEADING "PivotTable with PAGEFIELDS" PRINT PRICE COST ON TABLE HOLD AS EXL2K11 FORMAT EXL2K PIVOT PAGEFIELDS PRODCAT PRODNAME PRODTYPE ON TABLE SET STYLE * TYPE=DATA, COLUMN=PRODCAT, COLOR=RED,$ TYPE=HEADING, COLOR=BLUE, STYLE=BOLD, SIZE=14,$ ENDSTYLE END
This output is:
How to: Reference: |
An Excel Named Range is a name assigned to a specific group of cells within an Excel worksheet that can be easily referenced by FOCUS applications. The FOCUS StyleSheet language facilitates the generation of Named Ranges.
The use of Excel Named Ranges provides many benefits, including the following:
To create Excel Named Ranges, use
TYPE=type, IN-RANGES=rangename, $
where:
Identifies the FOCUS report component to be included in the range. Normally, both of the following are used together:
DATA adds the DATA element of the report to the named range (excludes heading, footing, and column titles).
TITLE adds the TITLE element of the report to the named range (includes all column titles).
Note: Multiple elements can be added to the same named range.
Is the name assigned to the output in the Excel workbook your application is creating, and is also the name that will be referenced by other FOCUS applications.
This example creates one report in one worksheet of an Excel workbook. The code specific to Excel Named Ranges appears in bold in the following syntax.
TABLE FILE GGSALES
PRINT
PRODUCT
DATE
UNITS
BY REGION
BY DOLLARS
ON TABLE SET PAGE-NUM OFF
ON TABLE SET BYDISPLAY ON
ON TABLE NOTOTAL
ON TABLE HOLD FORMAT EXL2K
ON TABLE SET STYLE *
UNITS=IN, SQUEEZE=ON, ORIENTATION=PORTRAIT, $
TYPE=REPORT, FONT='ARIAL', SIZE=9, COLOR='BLACK', BACKCOLOR='NONE',
STYLE=NORMAL, $
TYPE=DATA, IN-RANGES='RegionalSales', $
TYPE=TITLE, STYLE=BOLD, IN-RANGES='RegionalSales', $
ENDSTYLE
END
The Excel output is:
The name assigned to this Excel Named Range is RegionalSales. If additional rows of data are added, or columns of data are inserted, the named range will stretch to contain both new and existing data.
Excel Named Ranges are supported for the following Excel formats:
EXL2K, EXL2K FORMULA
Excel Named Ranges are not supported for the following Excel formats:
EXL2K BYTOC, EXCEL PIVOT
Excel Named Ranges are not supported with any report syntax that produces discontinuous data or uses columnar references that span multiple columns, which includes the following:
ACROSSCOLUMN, RECAP, RECOMPUTE, SUBHEAD, SUBFOOT, SUBTOTAL, SUB-TOTAL
How to: |
When a report is formatted as EXL2K, and null values are retrieved for one or more fields, blank spaces are displayed by default in each cell of the report output for the empty (null) fields. This behavior is the result of SET EMPTYCELLS ON being set by default in the background of all EXL2K reports. If you want to identify null values with something other than blank spaces, a character string can be used to populate all empty fields in a report.
Outside of a report request, use the following syntax
SET NODATA = character_string SET EMPTYCELLS = [ON|OFF]
In a report request, use the following syntax
ON TABLE SET NODATA character_string ON TABLE SET EMPTYCELLS [ON|OFF]
where:
Is the string of characters displayed in the cells of the report for each field where null values are retrieved from the database. The maximum number of characters is 11. If the number of characters in the string exceeds the length of the output field, the additional characters will not be displayed. If special characters are used, the string must be enclosed in single quotes. SET EMPTYCELLS OFF must also be specified to make the SET NODATA command effective.
Indicates that empty spaces are displayed in the cells of the report for each field where null values are retrieved from the database. ON is the default.
Indicates that zeros, or the character string specified with the SET NODATA command, will be displayed in the cells of the report for each field where null values are retrieved from the database. OFF must be specified when using SET NODATA.
The following syntax utilizes the default behavior of ON TABLE SET EMPTYCELLS ON, which is set in the background:
TABLE FILE CAR SUM SALES BY COUNTRY ACROSS SEATS ON TABLE HOLD FORMAT EXL2K ON TABLE SET STYLE * TYPE = ACROSSTITLE, STYLE=BOLD,$TYPE = TITLE, STYLE = BOLD,$ ENDSTYLE END
The following output displays empty spaces in the cells of the report for each field where null values are retrieved from the database:
The following syntax utilizes the SET NODATA command:
TABLE FILE CAR SUM SALES BY COUNTRY ACROSS SEATS ON TABLE SET NODATA 'n/a' ON TABLE SET EMPTYCELLS OFF ON TABLE HOLD FORMAT EXL2K ON TABLE SET STYLE * TYPE = ACROSSTITLE, STYLE=BOLD,$TYPE = TITLE, STYLE = BOLD,$ ENDSTYLE END
Note: If you do not add SET EMPTYCELLS OFF, the SET NODATA command will be ignored.
The following output displays 'n/a' in the cells of the report for each field where null values are retrieved from the database:
The following syntax turns off the default SET EMPTYCELLS behavior and does not use SET NODATA, which makes it impossible to distinguish null values from zero quantities:
TABLE FILE CAR SUM SALES BY COUNTRY ACROSS SEATS ON TABLE SET EMPTYCELLS OFF ON TABLE HOLD FORMAT EXL2K ON TABLE SET STYLE * TYPE = ACROSSTITLE, STYLE=BOLD,$TYPE = TITLE, STYLE = BOLD,$ ENDSTYLE END
The following output displays zeros in the cells of the report for each field where either null values are retrieved from the database or the quantity is zero:
How to: Reference: |
Excel Table of Contents (TOC) is a feature that enables you to generate a multiple worksheet report in which a separate worksheet is generated for each value of the first BY field in the FOCUS report.
Note: This feature can be used only with Excel 2002 or higher releases because it requires the Web Archive file format, which was not available in Excel 2000 and earlier releases.
Only a single BY field is allowed in an EXL2K Table of Contents report.
ON TABLE HOLD FORMAT EXL2K BYTOC
Since only one level of TOC is allowed for EXL2K reports, the optional number following the BYTOC keyword can only be 1.
The SET COMPOUND syntax, which precedes the TABLE command, may also be used to specify that a TOC be created:
SET COMPOUND=BYTOC
Since a TOC report is burst into worksheets according to the value of the first BY field in the report, the report must contain at least one BY field. The bursting field may be a NOPRINT field.
SET COMPOUND=BYTOC TABLE FILE CAR PRINT SALES BY COUNTRY NOPRINT BY CAR ON TABLE HOLD FORMAT EXL2K ON TABLE SET STYLE * type=report, style=bold, color=yellow, backcolor=black, $ type=data, backcolor=red, $type=data, column=car, color=blue, backcolor=yellow, $ END
The output is:
Reference: |
Excel Compound Reports is a feature which enables you to generate multiple worksheet reports using the EXL2K output format.
The syntax of this feature is identical to that of PDF Compound Reports. By default, each of the component reports from the compound report is placed in a new Excel worksheet (analogous to a new page in PDF). If the NOBREAK keyword is used, the next report follows the current report on the same worksheet (analogous to starting the report on the same page in PDF).
Output is generated in Microsoft's Web Archive format. This format is labeled Single File Web Page in Excel's Save As dialog. Excel provides the conventionally given file types: MHT or MHTML. FOCUS uses the same XHT file type that is used for EXL2K reports.
The components of an Excel compound report can be FORMULA or PIVOT reports (subject to the restrictions). They cannot be Table of Contents (TOC) reports.
Note: Excel 2002 (Office XP) or higher must be installed. This feature will not work with earlier versions of Excel since they do not support the Web Archive file format.
As with PDF, the keywords OPEN, CLOSE, and NOBREAK are used to control Excel compound reports. They can be specified with the HOLD command or with a separate SET COMPOUND command.
NOBREAK may appear with OPEN on the first report, or alone on a report between the first and last reports. (Using CLOSE is irrelevant, since it refers to the placement of the next report, and no report follows the final report on which CLOSE appears.)
TYPE=REPORT, TITLETEXT='Summary Report', $
Excel limits the length of worksheet titles to 31 characters. The following special characters cannot be used: ':', '?', '*', and '/'.
The HOLD FORMAT syntax used in the first component report in a compound report applies to all subsequent reports in the compound report, regardless of their format.
SET PAGE-NUM=OFF TABLE FILE CAR HEADING "Sales Report" " " SUM SALES BY COUNTRY ON TABLE SET STYLE * type=report, titletext='Sales Rpt', $ type=heading, size=18, $ ENDSTYLE ON TABLE HOLD AS EX1 FORMAT EXL2K OPEN END
TABLE FILE CAR HEADING "Inventory Report" " " SUM RC BY COUNTRY ON TABLE SET STYLE * type=report, titletext='Inv. Rpt', $ type=heading, size=18, $ ENDSTYLE ON TABLE HOLD FORMAT EXL2K END
TABLE FILE CAR HEADING "Cost of Goods Sold Report" " " SUM DC BY COUNTRY ON TABLE SET STYLE * type=report, titletext='Cost Rpt', $ type=heading, size=18, $ ENDSTYLE ON TABLE HOLD FORMAT EXL2K CLOSE END
The output for each tab in the Excel worksheet is:
SET PAGE-NUM=OFF TABLE FILE CAR HEADING "Sales Report" " " PRINT RCOST BY COUNTRY ON TABLE SET STYLE * type=report, titletext='Sales Rpt', $ type=heading, size=18, $ ENDSTYLE ON TABLE HOLD AS PIV1 FORMAT EXL2K OPEN END
TABLE FILE CAR HEADING "Inventory Report" " " PRINT SALES BY COUNTRY ON TABLE SET STYLE * type=report, titletext='Inv. Rpt', $ type=heading, size=18, $ ENDSTYLE ON TABLE HOLD AS PPPP FORMAT EXL2K PIVOT PAGEFIELDS TYPE SEATS CACHEFIELDS MODEL MPG RPM END
TABLE FILE CAR SUM RCOST BY COUNTRY BY CAR BY MODEL BY TYPE BY SEATS SUMMARIZE ON MODEL SUB-TOTAL ON TABLE HOLD AS XFOCB FORMAT EXL2K FORMULA END
TABLE FILE CAR HEADING "Cost of Goods Sold Report" " " PRINT DCOST BY COUNTRY ON TABLE SET STYLE * type=report, titletext='Cost Rpt', $ type=heading, size=18, $ ENDSTYLE ON TABLE HOLD AS ONE FORMAT EXL2K CLOSE PIVOT PAGEFIELDS RCOST CACHEFIELDS MODEL TYPE SALES ACCEL SEATS END
The output for each tab in the Excel worksheet is:
In this example, the first two reports are on the first worksheet, and the last two reports are on the second worksheet, since NOBREAK appears on both the first and third reports.
TABLE FILE CAR HEADING "Report 1: England" PRINT DCOST BY COUNTRY BY CAR IF COUNTRY EQ ENGLAND ON TABLE HOLD FORMAT EXL2K OPEN NOBREAK ON TABLE SET STYLE * type=report, color=red, $ type=data, backcolor=yellow, $ type=heading, color=blue, $ END
TABLE FILE CAR HEADING " " " " "Report 2: France" PRINT RCOST BY COUNTRY IF COUNTRY EQ FRANCE ACROSS SEATS ON TABLE HOLD FORMAT EXL2K ON TABLE SET STYLE * type=report, color=lime, backcolor=fuschia, style=bold, $ type=title, color=black, style=bold+italic, $ type=heading, backcolor=black, $ END
TABLE FILE CAR FOOTING "Report 3 - All" PRINT SALES BY COUNTRY BY CAR ON TABLE HOLD FORMAT EXL2K NOBREAK ON TABLE SET STYLE * type=report, backcolor=yellow, style=bold, $ type=title, color=blue, $ type=footing, backcolor=aqua, $ END
TABLE FILE CAR HEADING " " " " "Report 4" PRINT SALES BY COUNTRY BY CAR ON TABLE HOLD FORMAT EXL2K CLOSE ON TABLE SET STYLE * type=report, color=yellow, backcolor=black, style=bold, $ END
The output is:
Reference: |
After creating an Excel 2000 formatted file, you must transfer it from the mainframe to your PC to view and use it. The following illustrates the process of using FTP in Microsoft Windows to retrieve the files from the mainframe:
C:\temp\work>ftp ibimvs Connected to ibimvs.ibi.com. 220-FTPD1 IBM FTP CS V2R10 at IBIMVS.IBI.COM, 15:24:50 on 2003-11-06. 220 Connection will close if idle for more than 5 minutes. User (ibimvs.ibi.com:(none)): userid1 331 Send password please. Password: 230 USERID1 is logged on. Working directory is "USERID1.". ftp> get pivotmvs.xht pivot.xht 200 Port request OK. 125 Sending data set USERID1.PIVOTMVS.XHT 250 Transfer completed successfully. ftp: 8387 bytes received in 0.14Seconds 59.48Kbytes/sec. ftp> get pivotmvs.xml pivot.xml 200 Port request OK. 125 Sending data set USERID1.PIVOTMVS.XML 250 Transfer completed successfully. ftp: 1940 bytes received in 0.16Seconds 12.44Kbytes/sec. ftp> by 221 Quit command received. Goodbye.
How to: Reference: |
EXL97 is an HTML-based HOLD format for generating formatted Excel 97 spreadsheets. EXL97 is a full StyleSheet driver for accurately rendering all report elements (such as headings and subtotals, for example) as well as applying StyleSheet syntax (such as conditional styling). You must have Microsoft Excel 97 or higher installed on your computer to display an Excel 97 report.
While Excel 97 is fully compatible with Excel 2000 and Excel 2002, we strongly recommend upgrading to Excel 2000 to exploit its broader range of features and future Excel enhancements, which will primarily be made to the EXL2K format. See Limitations for FORMAT EXL97.
To produce an Excel 97 spreadsheet, create a FOCUS report using the Excel 97 HOLD option and then transfer the output file to your browser and open it in Excel 97. The HOLD syntax is
[ON TABLE] HOLD [AS filename] FORMAT EXL97
where:
Creates an Excel-formatted HTML file, with an extension of .HTM, which may include styling based on FOCUS StyleSheet features. The MIME type assigned automatically designates Excel as the active application for this file type. Before you can see or work with this file you must transfer it to your PC.
The following example shows how to create a report in EXL97 format based on the contents of CENTORD, with conditional styling:
TABLE FILE CENTORD
HEADING
"Order Revenue"
"Styled Report in Excel 97"
" "
SUM ORDER_DATE LINEPRICE AS 'Order,Total:'
BY HIGHEST 10 ORDER_NUM
ON TABLE SET PAGE-NUM OFF
ON TABLE HOLD FORMAT EXL97
ON TABLE SET STYLE *
TYPE=HEADING, COLOR=NAVY, SIZE=10, $
TYPE=HEADING, LINE=2, COLOR=RED, $
TYPE=DATA, BACKCOLOR=AQUA, STYLE=BOLD, WHEN=LINEPRICE GT 200000, $
TYPE=TITLE, STYLE=BOLD, $
END
The output is:
When you use Microsoft Internet Explorer and Excel 97, the Excel client opens in the background and the report launches in your browser. Depending on browser settings, you may see the Excel application open and minimized while viewing your report. Leave Excel open when viewing the spreadsheet. In Excel 97, you will be prompted to save the document as a Microsoft Excel Workbook with an .xls extension. This saves the file as a binary Excel document.
Information Builders |