Table Elements
  • 23 Aug 2024
  • 7 Minutes to read
  • Dark
    Light

Table Elements

  • Dark
    Light

Article summary

General

Table report element can be used to export data in tabular form into the Template.

General Properties

This type of report element has the following general properties:

Name

Description
NameThe name of the table element. This name will be displayed in the tree hierarchy of the content explorer of the Report Designer.
CodeThe code of the table element. There must be no other report element within the same report with the same code. The code is used to reference the report element from within a Template (see below).
ConditionAn optional condition Expression; if it returns True or 1 the condition is considered to be fulfilled and the table will be included in the report document. If it returns something other than True or 1 the exclusion settings (see below) will be applied. If you leave this property empty, the condition is considered to be always fulfilled. The condition expression is evaluated after the preparation Actions of the table element have been executed.
Preparation ActionsA list of Actions that will be executed before the table element will be processed.
Fail On Filter ExceptionDetermines what shall happen if an exception occurs when executing a preparation action that performs a filter (e.g. because the value to which you want to filter does not exist). When enabled, an exception will be thrown and the report document creation will be cancelled; when disabled, the table will be ommitted from the output.
SourceDatasource Object. When selecting this option, the table will be extracted from a datasource object (i.e. the visualization of a Qlik datasource or the table or view of an SQL Datasource.

SQL Query. When selecting this option, the table will be extracted from the result of an SQL query executed in an SQL Datasource. In that case any filters set (i.e. using Filter Datasource Field Action will be ignored and the direct result of the SQL query will be used.
Datasource ObjectThe Datasource object from which the data shall be extracted. This property is only applicable if the Source is Datasource Object.
SQL DatasourceThe SQL Datasource in which to execute the SQL query. This property is only applicable if the Source is SQL Query.
SQL QueryAn Expression that returns a String that contains the SQL query to execute. This property is only applicable if the Source is SQL Query.
Include HeaderWhen enabled, the table header will be included in the export. This property is not applicable in all scenarios and not all Datasource objects support headers.
Include TotalsWhen enabled, the grand totals of the table will be included in the export. This property is not applicable in all scenarios and not all Datasource objects support grand totals.
Null ValueAn Expression that evaluates to the representation of null values in the table. When left empty, null values will be represented with a blank.
TransposeWhen enabled, the table will be transposed (rows will become columns and columns will become rows). The transposition takes place after the Include Header, Include Totals, and Column Selector properties have been applied but before styles, column widths, and row heights are applied.
Column SelectorAll Columns. When you select this option, all columns of the source table will be included in the exported table.

Include Specified. If you select this option only columns specified in the Column Numbers property (see below) will be included in the exported table.

Exclude Specified. If you select this option all columns of the source table will be included in the exported table except for those specified in the Column Numbers property (see below).
Column NumbersAn Expression that returns one or more column numbers. This property is only applicable if the Column Selector property is set to something other than All Columns.

When the column selector is set to Include Specified, the expression needs to return one or more column numbers in the order in which they shall be included in the exported table.

If the selector is set to Exclude Specified, the expression needs to return one or more column numbers to be excluded from the table.

Insertion

To reference a table element from a Template you can drag and drop the element from the content explorer into the content editor. A reference with the following syntax will be added to the template:

Table Element Placeholder Syntax

%%<code>%%

NOTE

Every line of a Template in a CSV report may only contain constant text or the reference to a single element.

NOTE

If you change the code of a table element after you have inserted the placeholder into the template, you need to edit the placeholder in the template as well. Otherwise error messages will occur when creating the report document.

Examples

The following examples shows a Template that contains a fixed header. The second row contains the reference to an element named MyTableElement which will be replaced by the actual table when the report document is created:


Table Element Reference in CSV Report Template

Cell Settings

These settings can be used to manipulate properties of cells of the exported table. Every table report element has Default settings and (optionally) a number of custom cell settings. For every cell of the exported table, the applicable cell settings are evaluated; if custom cell settings are found, they are applied, otherwise the default settings are used.

NOTE

Only the first cell settings whose selector fits a cell will be applied to that cell (even if subsequent cell settings may also apply); cell settings are never combined.

Default Settings

The default cell settings are applied to all cells for which no custom cell settings have been found. They have the following properties:

Name

Description
Custom ValueWhen enabled, you can specify an Expression that may be used to override the value of the cell. The expression needs to return the effective value of the cell. See below to see available expression parameters for this expression.

Custom Settings

You can specify zero or more custom cell settings which will be used with a higher priority than the default cell settings. Custom cell settings have the following additional properties:

Name

Description
NameThe name of the custom cell settings.
Cell SelectorDepending on Cell Type. If you select this option, you can select Table Cell Types to which the custom settings apply.

Depending on Column Number. If you select this option, you can specify a range of column numbers (starting with 1) for which the custom settings apply.

Depending in Column Number and Cell Type. If you select this option, you can specify a range of column numbers (starting with 1) and Table Cell Types. Only cells for which both conditions apply are affected.

Depending on Row Number. If you select this option, you can specify a range of row numbers (starting with 1) for which the custom settings apply.

Depending on Row Number and Cell Type. If you select this option, you can specify a range of row numbers (starting with 1) and Table Cell Types. Only cells for which both conditions apply are affected.

Depending on Row and Column Number. If you select this option, you can specify a range of row numbers (starting with 1) and column numbers (starting with 1) to which the custom settings apply.

Depending on Custom Condition. If you select this option, you can specify a custom condition Expression; the custom settings are applied to all cells for which the condition returns True or 1. See below for available expression parameters.

Expression Parameters

These are the available expression parameters for custom cell value and condition Expression of cell settings:

Name

Description
CellValueThe value of the cell for which the cell settings are evaluated.
CellTypeThe Cell Type of the cell for which the cell settings are evaluated.

0. DataTopHeader
1. TotalsTopHeader
2. SubTotalsTopHeader
3. DataLeftHeader
4. TotalsLeftHeader
5. SubTotalsLeftHeader
6. Data
7. Total
8. SubTotal.
9. Filler
ColumnNumberThe column number of the cell for which the cell settings are evaluated (the first column has column number 1).
IsCellValueNumericTrue if the value of the cell for which the cell settings are evaluated is numeric, otherwise False.
RowNumberThe row number of the cell for which the cell settings are evaluated (the first row has row number 1).

Example 1

Let's suppose you only have default cell settings (i.e. no custom cell settings) and you have the following custom value expression set up:

Custom Value Expression

If([ColumnNumber]=1 And [RowNumber]=2, "Hello World", [CellValue])

Since there are no custom cell settings, the default settings are applied to all cells of the table. The custom value expression leads to the cell in the first column and second row to have the text Hello World; all other cells with keep their original value (defined by the [CellValue] expression parameter).

NOTE

Different cell settings are never combined; only the first cell settings whose selector targets a particular cell will be applied to that cell.


Was this article helpful?

What's Next