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 Clarify 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 Clarify can be instructed to return a null value or throw a transformation error.
Business Use
The most common use case for these objects is usually to convert state abbreviations (Pennsylvania to PA, for example) or other abbreviations discussed in the examples below.
How the Object Works
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.
Key | Value |
CS | Case |
EA | Each |
DZ | Dozen |
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.
Key1 | Key2 | Value |
Customer111 | PA | Warehouse16 |
Customer111 | OH | Warehouse22 |
Customer222 | PA | Warehouse17 |
Customer222 | FL | Warehouse31 |
Customer222 | TX | Warehouse14 |
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.
Key1 | Key2 | Value |
DOZEN | 001 | 1.23 |
DOZEN | 010 | 1.00 |
DOZEN | 100 | .75 |
CRATE | 001 | .42 |
CRATE | 010 | .05 |
Process Summary
- Create and define the object.
- Reference it from either a Business Process (as a Task) or a Ruleset (as an Action).
Comments
0 comments
Please sign in to leave a comment.