A table node is a node that contain a table in the Table data (library.table.TableData) member type. Table nodes are used both to store and generate tables.
There are five ways to create a table node:
- By writing it manually.
- By generating it from a list of nodes that define the rows and a view that defines the columns.
- By manipulating another table.
- By generating it using a script.
- By loading it from another node.
Manual table node
Use the Table (library.table.TableType) node type to create a table node using JSON. This can be used in three ways:
- To provide data as input to other processing.
- To act as a container for generated table data.
- To check table structures during solution development.
Generate a table node from nodes and a view
Use the Table Builder (library.table.TableBuilderType) node type to create a table from a list of row nodes and a view which defines the columns on the node. It uses the following inputs:
- Source node - the node from which the row nodes will be read.
- Source member type - the member type on the source node from which the nodes will be read. If omitted, then all the nodes in the source node package will be used.
- A view which defines the columns for the table. Views are created using the View (library.table.ViewType) node type. They list the member types from the nodes which should be used on the table. They can also list column scripts which are used to build columns. See Table views and columns for more details. If no view is given, the default view will be used.
- Options for the table, such as Table display options. These will override options set on the view.
Table building can be a process-intensive activity. The table builder does not automatically update the table when the source node changes (the source node member type has the Ignore Target Change tag set). If you do want the table node to update automatically, list the source node, or another node that is dependent on the source node, in the Depends on section.
If you do not want to update the table automatically, you can get it to update occasionally after the source node changes using delayed derivation.
A number of node type types can be used for manipulating tables.
- Filter Table creates a table from the rows and columns of another table, like a SQL select statement. The related Simple Filter lets you set a single column to filter on, and then provides a drop-down list of values for filtering.
- Merge Table creates a table by merging two other tables, like a SQL JOIN or UNION statement. For convenience, this also contains filter functionality.
- Aggregator Table creates a table which summarises another table, by grouping and applying column functions such as sum() and count().
Each of these also has a ..Type version that pre sets the rules for the manipulation in the node type. These are more suitable when building a solution for distribution, as they prevent the user from modifying the manipulation rules.
- Filter Table Type creates a type for creating a pre-set table filter.
- Merge Table Type creates a type for creating a pre-set table merge.
- Aggregator Table Type creates a type for creating a pre-set table aggregator.
Solutions can use these types to create final results tables from source tables built using the Table Builder or other methods.
Generate a table node using a script
There are two node types for creating table nodes with scripts.
Script Table (library.table.ScriptTableType) builds a table from a script defined on the table instance itself. It is useful for simple scripts.
Script Table Type (library.table.ScriptTableTypeType) creates a type on which you define a script, and which is then used to create table instances. The table instances have Bindings which can be interrogated by the script, tucked away under the Advanced tab. Note that these are static bindings, not dynamic bindings, and they must be accessed using application.getContext().getBinding(), not application.getBinding().
These script tables update automatically when any bound nodes change.
If required, dynamic bindings can be set using an inherited instance of Dynamic Bindings (library.parts.DynamicBindingsType) on the table instance or a parent package.
Delayed derivation can be used with dynamic binding to update tables occasionally after other data changes.
Load a table from another node
Table Loader (library.table.TableLoaderType) creates a table node by loading data from another node. The node from which the table is to be loaded and the member type to be read are identified by the Table source (library.table.TableSource) and Table member type (library.table.TableMemberType) members respectively. These default to the node itself and to Table data.
The Table Member Type can be a regular member type or a dynamic table, which allows the data to be calculated as it is loaded. See dynamic tables for more details.
When using Table Builder, Script Table, a type created from Script Table Type or Table Loader, an additional raw table data field is available when you look at tab number 0, by appending
?tabNumber=0 to the page address. This can be useful for debugging, or for copying calculated data to another table.
When you create a table using a script on the table node, specify a table using a view that runs a column script, or load a dynamic table based on a script, the script will run under your authority. For this reason, some member types in some of the table node types can only be updated by the node owner.