Data Management Capabilities > Managing Part Structures > Examples and Best Practices for Advanced Selection Logic > Common Logic Expressions > Combining Two Expressions with an AND Operator
Combining Two Expressions with an AND Operator
You may wish to evaluate two responses provided by the user to include a certain component in the variant only if the user’s responses are 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. And there might be a technical requirement that the large table with the metal table top requires an additional support member for safety reasons.
To combine two expressions using an AND 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 additional support.
4. Add a boolean non-input parameter to the configurable module. For example:useExtraSupport to represent the usage of the additional support.
5. Define the expression for the boolean parameter as a combination of the values of the two string parameters. For example: askSize.equals(“large”) && askMaterial.equals(“metal”)
6. Add the boolean parameter. For example, add useExtraSupport to the Inclusion Option of this configurable module for the additional support part or structure of parts.
If the user selects the value large for the askSize parameter and the value metal for the askMaterial parameter, then the expression is true, and the additional support 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 extra support part is excluded from the variant.