Complex If/Then Expressions Using Case Tables
In many situations, a simple If/Then expression is not sufficient. For example, you may have a complex set of input conditions and multiple corresponding output values.
In this case, the suggested approach is to establish a case table, as before, but with many more columns. Have some of the columns represent the input conditions and other columns represent the output conditions. Consider the following example:
askMaterial
askTrim
askInlay
supportMaterial
legMaterial
Oak
Walnut
White
Oak
Walnut
Oak
Walnut
Black
Walnut
Oak
Oak
Cherry
White
Oak
Walnut
Oak
Cherry
Black
Walnut
Oak
Maple
Cherry
White
Maple
Cherry
Maple
Cherry
Black
Cherry
Maple
Maple
Walnut
White
Maple
Cherry
Maple
Walnut
Black
Walnut
Maple
In this example, a rectangular table has a top with three different material combinations: the material of the top, the material of the trim and the color of the inlay. The first three columns of this case table represent these values.
Based on these selections, the material for the support and the legs of the table are automatically selected – as shown by the last two columns of this case table.
After the values of askMaterial, askTrim, and askInlay are specified by the user, the case table assigns the corresponding values for supportMaterial and legMaterial.
For example, if the user selects a material of Maple, a trim of Cherry and a White Inlay, the support is defined as Maple and the legs are defined as Cherry.
Was this helpful?