Data Management Capabilities > Managing Part Structures > Examples and Best Practices for Advanced Selection Logic > Common Logic Expressions > Conditional Expressions
Conditional Expressions
In certain situations, you may require a parameter to have two different values based on a certain condition. For example, you have a small table fitted with casters to make it easily moveable. However, for some situations, the table may be fitted with two locking casters, so that the movement of the table can be more easily controlled.
While you could achieve this result using a case table, you could also use a conditional expression such as:
numberStandardCasters == (useLockingCaster ? 2 : 4)
This expression means:
If useLockingCaster is true, then numberStandardCasters is 2, else it is 4
In this example, numberStandardCasters is an integer parameter that is used to define the number of standard (non-locking) casters on the table. This parameter should be defined using either a type of integer or real number, and then assigned to the usage link between the parent part (in this case, the small table) and the child part (in this case, the standard casters) using the QuantityOption field on the Uses tab for the parent part.
This example also uses the boolean parameter useLockingCaster, which has a value of True if locking casters are desired, and a value of False when they are not. Therefore, if the locking casters are desired, the value of useLockingCaster is True, and the value of numberStandardCasters is equal 2.
Although a conditional expression of this type is very powerful, it cannot be used to perform conditional assignments. Expressions similar to the following are not supported:
(useLockingCaster) ? legLength == 48 : legLength == 52