Skip to content

projectionResultsToTable

Copies results from one or more projection nodes into a table. Optionally performs a SQL query on the results before creating the table.

Required reading

The following topics are essential for understanding this function:

Signature

projectionResultsToTable(
    projectionNodes,
    includeHierarchyProperties=TRUE,
    includeVariables=TRUE,
    query="",
    dataTypes=dict()
)

Arguments

projectionNodes

An array of projection node IDs. These are the projection nodes from which to get the data for the table.

You should use the createProjectionNodes function directly here, or anything that returns an array of projection node IDs, e.g.:

concatenateArrays(createProjectionNodes(…), createProjectionNodes(…), …)

includeHierarchyProperties

Whether to include hierarchy node properties in the table. One column per hierarchy property.

  • If set to True, all hierarchy node properties will be included.
  • If set to False, no hierarchy node properties will be included.
  • If set to an array of strings, only the hierarchy node properties with the given names will be included.

This includes:

  • User-defined hierarchy properties.
  • Standard hierarchy properties such as hLevel, hName, and hPath.
  • A hierarchy node name for each level.
includeVariables

Whether to include the variables (time vectors and scalars) from the projection node results in the table.

  • If set to True, all variables will be included.
  • If set to False, no variables will be included.
  • If set to an array of strings, only the variables with the given names will be included.
query

An optional query to be applied to the table. See SQL queries for details.

Use this to limit the results to a subset of the data, or to perform calculations on the data before creating the table.

An empty argument or empty string here means that no query will be performed, i.e. all results from all given projection nodes will be used.

dataTypes

A mapping of column names to data type specifiers. See data types for details.

For columns not given in dataTypes, the data types and number formats of the source will be used. However, sometimes you may want to override the data type of a column, or the SQL query may return columns which are not present in the source table. In these cases, you can use this argument to specify the data types of the columns.

Performance tip

Using includeHierarchyProperties or includeHierarchyNames together with query just to filter projection nodes is inefficient. Ensure that the value passed to projectionNodes already contains only the projection nodes whose results you really want to include. See the hierarchyFilter argument of the createProjectionNodes function.

Examples

See the example workbook.