Use with a Condition Filter
Compare Filters can also be used with Condition Filters to create complex expressions that include ANDs and ORs and levels of parentheses. For more information, see The Condition Filter.
For example, consider the element arrangement shown above. For each row of the datalayer, the three Compare Filters will be evaluated first. Each of them will produce a True or False value as a result of their comparison operations. Those values will be assigned to @Compare tokens which include the element ID, for example: @Compare.CompareFilter1~. The scope of these tokens is limited to the parent Condition Filter.
After all of the Compare Filters are evaluated, the Condition Filter will be evaluated and its Condition attribute value can include expressions that use the @Compare tokens. For example, the Condition attribute value above might be:
- @Compare.CompareFilter1~ AND (@Compare.CompareFilter2~ OR @Compare.CompareFilter3~)
And, of course, you can also use other types of tokens and literal values in the Condition attribute to get the expression you need, such as:
- @Data.UnitPrice~ <= 100 AND (@Compare.CompareFilter1~ OR @Compare.CompareFilter2~)
You may be able achieve the same results with complicated scripting for the Condition attribute value, however, in most cases use of multiple Compare Filters as shown in this example will produce better performance than scripting.