@@IsInCollection
Use @@IsInCollection when you want to see if any of the elements within a dataset match a test. Typically used with @@IncludeIf.
Syntax:
@@IncludeIfInCollection(<source>, <test>)
Parameters:
The nodes to check in the xml, specified as #dataset.node. All matching nodes are considered the collection.
An expression that evaluates as true or false. The test can include tokens.
When testing on a string (non-numeric value), enclose the data in single quotes. When testing on a number, do not use single quotes.
Use Or and And for testing multiple conditions. Or evaluates to true when any of the conditions are true. And evaluates to true only when all of the conditions are true.
Any node within the collection that tests true is treated as true even if other nodes test false.
A false result only occurs if all nodes within the collection are false.
You can use any of the following test conditions
equals
does not equal
less than (only allowed with numeric data)
greater than (only allowed with numeric data)
Example
XML:
<Options>
<Option>
<AgIsIncluded>N</AgIsIncluded>
<SpIsTerminalExtension>Y</SpIsTerminalExtension>
</Option>
<Option>
<AgIsIncluded>N</AgIsIncluded>
<SpIsTerminalExtension>N</SpIsTerminalExtension>
</Option>
</Option>
Code:
@@IncludeIf(@@IsInCollection(#Options.Option, #SpIsTerminalExtension = ‘Y’))
This content is included because the value of the first option’s <SpIsTerminalExtension> is ‘Y’
@@End
@@IncludeIf(@@IsInCollection(#Options.Option, #AgIsIncluded = ‘Y’))
This content is not included because no option has an <AgIsIncluded> value of ‘Y’
@@End