A Code Table object is a look-up table that validates input data and converts it to an output string or behavior value.
In the event that the input data is not found in the Code Table, the defined default string or behavior results.
A Code Table may be either Single Input (a one-key lookup) or Double Input (with a lookup performed on the first key and a comparison operator executed on the second key).
For both Single Input and Double Input Code Tables, a default value/behavior instructs the Studio how to handle instances when it cannot locate the input key(s) in a Code Table. Besides the value of the input key(s), a string value (such as “Not Found”) may be specified, or the Studio can be instructed to return a null value or throw a transformation error.
The most common use case for this objects are usually for converting state abbreviations (Pennsylvania to PA, for example) or other abbreviations, such as the in the examples below.
How the Object WorksSingle Input
For a Single Input Code Table, one input value is evaluated. If that value matches one of the Code Table’s Key entries, then the corresponding lookup Value for that Key is passed out.
In this example, if “EA” is passed in as the Key, then “Each” is passed out as the Value.
For a Double Input Code Table, two input values are evaluated. When the Key1 input value matches one of the Code Table’s Key1 entries, the specified Comparison Type operator is performed on the Key2 input value. Comparison Type options are: Equal To, Greater Than, Greater Than Or Equal To, Less Than, and Less Than Or Equal To. If the Key2 input value comparison is satisfied, then the corresponding lookup Value for the Key1-Key2 pair is passed.
In this Equal To example, if “Customer222” is passed in to Key1 and “PA” is passed in to Key2, then “Warehouse17” will be passed.
In this Greater Than or Equal To example, if “DOZEN” is passed in to Key1 and “010” is passed in to Key2, then “1.00” is passed out. Note that numeric Key2 input values must be padded with leading zeros; also, numeric values to be passed in to the Key2 parameter must (a) be converted to string and (b) padded with leading zeroes.
- Create and define the object.
- Reference it from either a Business Process (as a Task) or a Ruleset (as an Action).
Defining Code Tables
To define this object (once created) you specify a default value, indicate if the input keys are case-sensitive, and create and assign table entries. For Double Input Code Tables, the comparison type must also be selected.
- Select a Comparison Type (for double input only). Choices are Equal To, Greater Than, Greater Than Or Equal To, Less Than, and Less Than Or Equal To. By design, all Single Input Code Tables are Equal To.
- For both Single Input and Double Input Code Tables, specify the Default Value to instruct the Studio how to proceed when it cannot locate the input key(s). Choices are Key for Single Input Code Tables, Key1 and Key2 for Double Input Code Tables, a user-defined string (such as “Not Found”), ReturnNull and ThrowError.
- Under the Table Entries section, click the Add button to add a row, and then enter the key(s) and corresponding value. Note that a Value may be either a string or any of the available value/behavior choices: Key for Single Input Code Tables, Key1 and Key2 for Double Input Code Tables, a user-defined string (such as “Not Found”), ReturnNull, and ThrowError.
- Click Save to complete task.
Please sign in to leave a comment.