Create Data Table

From PresenceWiki
Jump to: navigation, search

Create datatable node.png

Create Data Table

The Create Data Table Node allows you to prime the Presence Context with a Data Table consisting of custom data. This can be useful for testing or just when you wish to include a table of static data.

To include a Create Data Table node in your Task drag the "Create Data Table" item into your Task from the Data Access Task Elements List. You will then see the following input dialog:

Create data table editor 1.png

The first panel allows you to specify the column names and data types in the new Data Table. The five buttons beneath the list perform the following functions:

  • Add Column
  • Move Column Up
  • Move Column Down
  • Edit Column
  • Remove Column

When you are happy with the column names, click the "Rows" Tab to create rows for your Data Table:

Create data table editor 2.png

The four buttons provided are similar in function to those in the Columns tab:

  • Add Row
  • Move Row(s) Up
  • Move Row(s) Down
  • Remove Row(s)

After inserting a new row, double-click inside a cell to edit the cell value. Values can be literal (e.g. "Fred" or "15") or they can be dynamic (e.g. ":var{SURNAME}" or "&random{}" ). If references are made to other columns those columns must appear in the incoming Data Table and will be used as a merge hint.

Type Checking

At runtime values will be converted to the type specified in the column. If the conversion is not possible (for example the column is set up to contain Integers but a non-integer value is found) an error will be thrown.

If the data type is "Boolean" any values are permitted, but anything other than "true" (case insensitive) will be converted to "false".

Merge Strategy

If a Data Table already exists on the Presence Context it will be cross-merged with the new custom Data Table. Each row of the incoming Table will be matched with each row of the new Data Table and new columns will be appended on the right. The following diagram illustrates this:

Create data table merge strat.png

If you wish to use a different merge strategy (horizontal or vertical), you can make use of the Merge Data Node on a separate execution path, as in the following example:

Create data table merge example.png

Data Filter | Require Columns | Append Data Column | Multiple Column Appender

Drop Column | Drop Row(s) | Calculate Column Aggregate | Dataset Splitter | Merge Data

Create Data Table | Clear Data Table | Sort Data Table | Drop Duplicate Rows | Store Data Table | Retrieve Data Table

Task Elements > Data Table Nodes > Create Data Table