Training
Module
Evaluate Boolean expressions to make decisions in C# - Training
Learn the operators and techniques required to evaluate and compare values in your decision statements.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Removes the top two items from the stack, performs a Boolean AND of the two items, and then pushes the result onto the stack.
<ic:Operation Name="And" />
Top two items on the stack.
String result of the Boolean AND operation.
The And operation is useful when you need to evaluate multiple statements. The following example filter expression checks whether the activity name is "CheckPO" and the activity event is closed by using the And operation.
<ic:Filter>
<ic:Expression>
<wf:Operation Name="GetActivityName"/>
<ic:Operation Name="Constant">
<ic:Argument>CheckPO</ic:Argument>
</ic:Operation>
<ic:Operation Name="Equals"/>
<wf:Operation Name="GetActivityEvent"/>
<ic:Operation Name="Constant">
<ic:Argument>Closed</ic:Argument>
</ic:Operation>
<ic:Operation Name="Equals"/>
<ic:Operation Name="And"/>
</ic:Expression>
</ic:Filter>
In this example And is the final operation in the expression because it relies on the results of the comparisons (and pops them from the stack to perform the comparison). You can extend this idea to perform And operations on more than two items. For example, to evaluate whether Condition A and Condition B and Condition C are true, you would use an expression like the following:
<ic:Filter>
<ic:Expression>
<wf:Operation Name="GetActivityName"/>
<ic:Operation Name="Constant">
<ic:Argument>CheckPO</ic:Argument>
</ic:Operation>
<ic:Operation Name="Equals"/>
<wf:Operation Name="GetActivityEvent"/>
<ic:Operation Name="Constant">
<ic:Argument>Closed</ic:Argument>
</ic:Operation>
<ic:Operation Name="Equals"/>
<wf:Operation Name="GetActivityType"/>
<ic:Operation Name="Constant">
<ic:Argument>MyType</ic:Argument>
</ic:Operation>
<ic:Operation Name="Equals"/>
<ic:Operation Name="And"/>
<ic:Operation Name="And"/>
</ic:Expression>
</ic:Filter>
Training
Module
Evaluate Boolean expressions to make decisions in C# - Training
Learn the operators and techniques required to evaluate and compare values in your decision statements.