Difference between revisions of "Excel Template File"

From Vital Soft Wiki
Jump to: navigation, search
>Johno
(Main Sheet)
>Johno
(Main Sheet)
Line 32: Line 32:
  
 
'''Definition''' (required)
 
'''Definition''' (required)
: The name of a definition sheet.  This sheet must exist in the current document.  If the definition sheet name is prefixed by a # character, the sheet will be ignored.
+
: The name of a definition sheet.  A sheet with this name '''must exist''' in the current document.  If the definition sheet name is prefixed by a # character, the sheet will be ignored.
  
 
'''Main Sheet Example:'''
 
'''Main Sheet Example:'''

Revision as of 22:07, 19 April 2013

Overview

An Excel Template report is defined by a definition (template) file that specifies how the report should be created. Each template file must contain a "select sheet", a "Main Sheet" and one or more "Definition sheets".

  • Select Sheet
Like the DocumentDistribution file, the select sheet contains selection definitions. Selections defined in the template file are local and can only be used by the current report request. This sheet is required (and must contain valid column headers) even of no selections are defined.
  • Main Sheet
This sheet contains a list of definition sheets to execute. The main sheet allows you to specify a selection that applies to the definition sheet as well as a banding value. Specifying a banding field will cause "Sheet Level" banding to be applied.
  • Definition Sheets
Each definition sheet is a template of the sheet that will be created when the report is executed. The sheet contains cells that are copied "as is" without any changes as well as cells that are "evaluated". Cells that are evaluated can contain chart exports, or text that contains substituted values.

Select Sheet

This sheet contains local selection definitions used by the current report. Each selection consists of one or more steps that share the same selection name.

Main Sheet

The main sheet contains a list of all definition sheets in the template file. Each row in the main sheet refers to a single definition sheet to be executed. Definition sheets are executed in the order they appear in the main sheet.

SheetName (required)

The name of the sheet that will be created. The name can include references to the current date, the current banding value and to QlikView variables.

SheetExistsAction (ignored)

This field is currently unused, leave blank.

Banding (optional)

The name of a banding field. When a banding field is specified, the definition sheet is re-evaluated for each unique value of the banding field. Specifying a banding field causes "sheet level" banding and a new sheet will be created for each unique (possible) value. The banding value can be included in the output sheet name using the syntax: <band>

Selection (optional)

The name of a selection defined in the "Select Sheet" of either the current template file or the main document distribution file. If a selection with the same name exists in both locations, the local (template file) definition will be used.

Definition (required)

The name of a definition sheet. A sheet with this name must exist in the current document. If the definition sheet name is prefixed by a # character, the sheet will be ignored.

Main Sheet Example:

SheetName SheetExistsAction Banding Selection Definition
Member Totals Clear MbrTotals
<band> Mbrs MBR_BRANCH_NAME MbrTotalsByBranch

In the above example, the template must contain a total of 4 sheets: Select, Main, MbrTotals and MbrTotalsByBranch.

Definition Sheets

The definition sheet may contain any elements that you want. For example, the sheet may contain a logo, as well as text and calculated fields. The sheet may also contain special tags that will export charts and tables from the QlikView application into the final sheet. A tag can also generate customized text. The sheet is processed as follows:

  • If a selection is specified, execute the selection
  • If a banding field is specified, loop on each possible banding field value:
* Copy the "Used Range" (1) of the definition sheet into the new output file
* Set the row heights and column widths in the new sheet to match the definition sheet
* Walk all rows and columns looking for special tags
* If an export tag is found, process the export and insert the required number of rows.
* If a text tag is found, process the text statement and insert the text field in the final document

Special Template Tags

The definition sheet may contain special xml tags that are processed during the report execution.

Text Tag

The text tag will process the text within the tag and substitute any special values that it finds.

The general form of a text tag is:

<Text>Any text with substitutions.</Text>

The text substitution codes are:

  • <date>
The current date.
  • <band>
The current banding value.
  • $(VarName)
The value of any QlikView variable.
  • Examples:
<Text>Totals for <band> as of $(PriorMonthDate)</Text>
Will produce: Totals for FIRST AVENUE as of 2013-03-31
<Text>Report execution date: <date></Text>
Will produce: Report Execution date: 2013-04-19

The substituted text will appear in the final document with the same attributes (alignment, font, color, etc.) as it had in the definition sheet.

Export Tag

The export tag exports a single chart or table from the QlikView application into the same (relative) cell in the final document. When the exported chart is inserted in the final document additional rows will also be inserted to make room for any other cells that may appear in following rows in the definition sheet. (In other words, you do not need to anticipate the number of rows that will be consumed by the chart - the correct number of rows will always be inserted.)

The general form of the export tag is:

<Export><Object>QlikView Object ID</Object><Select>...</Select><Dims>...</Dims><Parms>...</Parms></Export>


Parms: SuppressHeader SuppressTotals AlwaysFullyExpanded