2D Table Node

The 2D Table Node takes exactly two input values, referred to as the X-Value and the Y-Value, and produces a single output. The output can be any valid JavaScript value. The 2D Table Node is very useful for applying simple segmentation to data. 

The input values for the 2D Table Node are set when the node is used within a graph. Within the node itself there are simple controls for adding rows and columns to the decision table. Each row and column is headed by a JavaScript expression and the table cell for which the row and column expressions are both true will give the return value. The X-Value expressions are evaluated left-to-right and the Y-Value expressions are evaluated top-to-bottom. 

The 'Add Column' and 'Add Row' buttons are used to add columns and rows to the table respectively. Each column or row is headed by a box which expects an expression to be entered in the 'Edit Operator' panel on the right hand side of the window. All JavaScript expressions are passed the Xponent internal variable 'VAL' which can be used in any valid JavaScript expression.

For example the screenshot below shows a 2D Table which expects to receive an Age and a Gender value as the X-Value and Y-Value inputs respectively and will return a segment identifier. The segment identifier (an integer literal) ranges between 1 and 4. 


The Operator for the middle column of the X-Value is shown in detail showing the use of the basic expression type: 

The Operator can also be given a display description to make the table more readable. Edit Operator panel would look like this: 

Applied to each of the rules this can be used to make the table more readable: 

 

2D Table Return Values

The 2D Table will return the value at the intersection of the X-Value and Y-Value row and column or it will return an 'error' in the Testing Console. The 2D Table can return any valid JavaScript literal value, a schema location or a public variable. 

For example to return a more complex segmentation object from the table above a literal such as this could be used for the cell return value: 

This allows complex two dimensional segmentations to be applied. 

Validation Warnings


WarningNote

Each table cell must have a valid (non-empty) data referenceOne or more table cells do not have a data reference (literal, schema or public variable) set.

Each 2D table row/column must have a conditionNo expression has been given for the column or row

Errors

  • Unable to find value for (x or y) parameter - one of the X or Y values has not been provided in the schema 





Privacy Policy
© 2022 CSG International, Inc.