%and keyword (SDL script)
This keyword is used as a logical AND operator, allowing you to AND multiple conditions. When ANDing conditions, True is returned only if each condition is True. Each condition must be enclosed in parentheses.
If you use only the %and keyword when evaluating multiple conditions, the order of the conditions does not matter; however, if you use both %and and %or keywords to evaluate multiple conditions, the order of the conditions is important. The following example demonstrates the order in which multiple conditions are processed.
%if (<condition 1>) %and/%or (<condition 2>) %and/%or (<condition 3>) %and/%or (<condition 4>) then...
In this example the conditions are evaluated as follows:
Condition 1 is evaluated against Condition 2.
The result of the preceding evaluation is evaluated against Condition 3.
The result of the preceding evaluation is evaluated against Condition 4.
If you are using a both %and and %or keywords with multiple conditions, you must order conditions correctly to achieve the required result.
Syntax
%if (<condition 1>) %and (<condition 2>) %and (<condition n>) %then...
Example
In this example, the Operations.sdl template is loaded only if the Type property is set to Class and the C Non Member property is True.
%if (%custom "Type" == "Class") %and
(%custom "C Non Member" == "True") %then
%load "Operations.sdl"
%endif
Was this helpful?