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.
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 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 “026” 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).