Simple If/Then Expressions Using Case Tables
One of the most common logic expressions is the If/Then statement. For example, you might want to ask the user to select a color for the exterior of a product and then automatically select a complimentary interior color. A case table is a set of conditions arranged in rows where each row represents a single If/Then expression.
To use a simple conditional expression using case table:
1. Create a configurable module.
2. Define a string input parameter. For example, exteriorColor.
Establish a prompt expression, for example, “Select the desired exterior color”.
Establish the valid exterior color values for this parameter’s constraint using values such as:
Red
White
Blue
3. Define a second non-input string parameter. For example, driveInteriorFromExterior.
Establish the valid interior color values for this parameter’s constraint using values such as:
Black
Brown
Gray
4. Define a case table, for example, pickInteriorColor, to automatically select the interior color based on the user’s exterior color selection such as:
Add both parameters, exteriorColor and driveInteriorFromExterior, to the case table.
Ensure that the case table contains the following values:
exteriorColor
driveInteriorFromExterior
Red
Black
White
Brown
Blue
Gray
In this case, once the user selects the first parameter exteriorColor the system automatically assigns the second parameter driveInteriorFromExterior the value from the case table. In essence, each row of the case table represents a simple If/Then statement, such as:
If exteriorColor = Red, then driveInteriorFromExterior = Black
Isto foi útil?