Including Two Expressions with an OR Operator
You may wish to evaluate two responses provided by the user to include a certain component in the variant if either of the user’s responses is equal to specific values.
For example, you might request the user to specify the size of a table (such as small, medium, or large) and the materials for the table top (such as wood or metal). There may also be a technical requirement that the small table or the wood table top required the use of a smaller shipping carton.
To include two expressions with an OR operator (||):
1. Create a configurable module.
2. Add two string input parameters to the configurable module. For example, askSize and askMaterial.
◦ Define an appropriate prompt value for each string parameters such as: Select the desired size and Select the desired material.
◦ Define appropriate constraints for each parameter such as small, medium and large for the askSize parameter and wood and metal for the askMaterial parameter.
3. Add a part or structure of parts to the configurable module to represent the small carton.
4. Add a boolean non-input parameter to the configurable module. For example, useSmallCarton to represent the usage of the small carton.
5. Define the expression for the boolean parameter as a combination of the values of the two string parameters. For example: askSize.equals(“small”)||askMaterial.equals(“wood”)
6. Add the boolean parameter. For example, add useSmallCarton to the Inclusion Option of this configurable module for the small carton part or structure of parts.
If the user selects the value small for the askSize parameter OR the value wood for the askMaterial parameter, then the expression is true, and the small carton part or part structure is included in the variant. If the user provides any other response, then either the askSize or the askMaterial parameter is false, and the small carton part is excluded from the variant.