This
Use the following menu options to navigate the SL1 user interface:
- To view a pop-out list of menu options, click the menu icon ().
- To view a page containing all the menu options, click the Advanced menu icon ().
This
What is an Output Template?
An Output Template is an Open Office Spreadsheet file (.ods file) that defines the format of the generated report. An Output Template defines the formatting and table structure you want to use for the generated report.
An output template includes one or more output directives. An output template directive indicates how output provided by report gluecode should be laid out. There are four general types of output directives:
- Array Binding Directives. These output template directives define a section of the output template (a cell, a row, a table, or an entire sheet) that will be repeated for each item in an array outputted by the gluecode. For example, suppose a report outputs a list of tickets, with one ticket on each row. The gluecode for the report outputs an array of tickets. The output template would include the bindrow output template directive, specifying the name of that array, to indicate the row that should be repeated for each ticket in the output.
- Conditional Directives. These output template directives include or exclude sections of the output template (e.g. columns, rows, tables, etc) based on the output from the gluecode. For example, suppose a report has an option that can be used to include or exclude certain columns. The glucode for the report would output a boolean value for each optional column, indicating whether the column should be included. The output template would include the ifcol output template directive in each column to indicate that the inclusion of that column is controlled by the boolean value.
- Style Directives. These output template directives can be used to dynamically apply styles to cells in the output. For example, suppose a report outputs a color-coded list of tickets, with the colors applied based on the severity of the ticket. The gluecode for the report would include the color that is associated with each ticket in the output. The output template would include the applystyle output template directive in the appropriate cell(s) to select the style that matches that color.
- Image and Chart Directives. These output template directives can be used to place images and charts in the output.
Output Methods
There are two different methods by which gluecode can output values to the output template. The structure of the output template is the same for both methods. Every report must use only one of the two methods:
- The $output array. This option passes the entire data set to the output template when the gluecode has finished executing. This method is easier to use. However, the PHP memory limit for the execution of a single report is 3 MB, which typically translates to a row-limit of 10,000.Large reports will generate a memory error and fail to execute when using the $output array.
- The $em7_report object. When using this option, output is passed incrementally using a set of methods associated with the $em7_report object. This method typically requires more lines of code in the gluecode. However, this option does not require the entire data set to reside in memory.
Array Binding Directives
The following directives can be used to dynamically repeat a section of the output template multiple times. These directives correspond to an array in the output; the number of times the section of the output is repeated is equal to the number of array elements supplied by the gluecode:
- [bindrow:array]. Binds an array from the output to a row. The array parameter must match the name of an array in the gluecode. If this directive is inside another repeating element, e.g. a table or sheet, use [bindrow:#.array]. When this directive is included on a formatted row, a single row in that format will be created for each item in the array. There is no closing directive for [bindrow:array]. The array value for each row is another array of values. To place a value from the array for a row in a column, use one or more of the following directives:
- {##}. Places the array key for this row.
- {#.key}. Places a value from the array of values for the row with array key key.
- [bindtable:array][endbindtable:array]. Binds an array from the output to a table. The array parameter must match the name of an array in the gluecode. If this directive is inside another repeating element, i.e. a sheet, use [bindtable:#.array]. When this directive surrounds a formatted table, a single table in that format will be created for each item in the array. Each [bindtable:array] directive must be closed with an [endbindtable:array] directive. The array value for each table is another array of values, typically including additional array dimensions for use with [bindrow:#.array] directives. To use the values from the array for a table, use one or more of the following directives:
- {##}. Places the array key for this table inside a cell.
- {#.key}. Places a value from the array of values for the table with array key key.
- [bindrow:#.array]. Binds an array from the array for a table to a row, i.e. nests repeating rows inside a repeating table. See the description of [bindrow:array] for a description on how to use this directive.
- [bindsheet:array]. Binds an associative array to a sheet in the output document. The array parameter must match the name of an array in the gluecode. When this directive is used on a formatted sheet, a sheet in that format will be created for each item in the array. There is no closing directive for [bindsheet:array]. The array value for each table is another array of values, typically including additional array dimensions for use with [bindtable:#.array] and [bindrow:#.array] directives. To use the values from the array for a sheet, use one or more of the following directives:
- {##}. Places the array key for this sheet inside a cell.
- {#.key}. Places a value from the array of values for the sheet with array key key.
- [bindrow:#.array]. Binds an array from the array for a sheet to a row, i.e. nests repeating rows inside a repeating sheet. See the description of [bindrow:array] for a description on how to use this directive.
- [bindtable:#.array]. Binds an array from the array for a sheet to a table, i.e. nests repeating tables inside a repeating sheet. See the description of [bindtable:array] for a description on how to use this directive.
- [bindcell:array]. Binds an array from the output to a row or cells. The array parameter must match the name of an array in the gluecode. If this directive is inside another repeating element, e.g. a row, a table, or a sheet, use [bindcell:#.array]. Each value in the array will be placed in a separate cell in the row. There is no closing directive.
Conditional Directives
The following output directives conditionally include output template elements in the output based on values passed by the gluecode:
- [columns:option]. Expands or collapses a set of merged cells to handle optional columns. option can be expand, collapse, or flex.
- [if:bool][endif]. Conditionally displays rows based on a boolean evaluation. If bool is true, this row up to and including the [endif] directive is displayed.
- [if:bool][else][endif]. Conditionally displays rows based on a boolean evaluation. If bool is true, this row up to the row beginning with [else] is displayed. If bool is false, the row beginning with [else] up to and including the [endif] directive is displayed.
- [ifcol:bool]. Conditionally displays columns based on a boolean evaluation. Place this directive at the bottom of the output template. If bool is true, this column is displayed. If bool is false, this column is hidden.
Style Directives
The following output directives change the style applied to individual cells:
- [cellstyle:style]. Changes the style of a cell to the specified style. The specified style must already exist in the template's available styles.
- [applystyle:style]. Adds style to a cell. This directive adds only the specified style; the specified style does not inherit properties or related styles from its parent style.
Image and Chart Directives
The following output directives add images or chart data passed by the gluecode:
- [bindimage:image]. Dynamically adds an image. Make sure the cell is large enough to contain the image.
- [bindchart:1]. Identifies a cell into which a chart will be inserted. The :1 is for future use.
The following Output Template Directives can be included in the same cell as a [bindchart:1] directive and will substitute values into the chart properties:
- [chart_xmin:value]. Substitutes the value of variable value into the Minimum field for the X-axis. You must uncheck the Automatic checkbox on the Output Template for value to be substituted.
- [chart_xmax:value]. Substitutes the value of variable value into the Maximum field for the X-axis. You must uncheck the Automatic checkbox on the Output Template for value to be substituted.
- [chart_xmajor:value]. Substitutes the value of variable value into the Major interval field for the X-axis. You must uncheck the Automatic checkbox on the Output Template for value to be substituted.
- [chart_xminor:value]. Substitutes the value of variable value into the Minor interval count field for the X-axis. You must uncheck the Automatic checkbox on the Output Template for value to be substituted.
- [chart_ymin:value]. Substitutes the value of variable value into the Minimum field for the Y-axis. You must uncheck the Automatic checkbox on the Output Template for value to be substituted.
- [chart_ymax:value]. Substitutes the value of variable value into the Maximum field for the Y-axis. You must uncheck the Automatic checkbox on the Output Template for value to be substituted.
- [chart_ymajor:value]. Substitutes the value of variable value into the Major interval field for the Y-axis. You must uncheck the Automatic checkbox on the Output Template for value to be substituted.
- [chart_yminor:value]. Substitutes the value of variable value into the Minor interval count field for the Y-axis. You must uncheck the Automatic checkbox on the Output Template for value to be substituted.
For more information on how these values affect the presentation of the graph, in the OpenOffice spreadsheet, go to the Object Properties page, go to the Scale tab, and select the button to open OpenOffice help.