Use Google to find help fast. For example, search on "xpressdox choosefromlist".

Test for Any or All repeated items meeting criteria

Test for Any or All repeated items meeting criteria

Suppose you are preparing a template for a Will, where various provisions need to be made for the children of the testator.  The children will then be represented on the template as a repeating item, and in various parts of the template, tests would be made to determine whether any or all of the children meet the necessary criteria.

Somewhere in the template the children would be listed, perhaps like this:

The children are:
<<ForEach(Child)>>
Name: <<Name>>
Gender: <<Gender>>
Age: <<Age>>
<<End()>>

You may then have a paragraph in the Will which needs to be included only if any (or in other words least one) of the children is a minor (i.e. age less than 18).  The test for “Any” would look like this:

<<If(count(Child[Age < 18]) > 0>>
The minor children must be blah blah …
<<End()>>

Another paragraph is required only if ALL the children are minors.  This test would look like this:

<<If(count(Child[Age < 18]) = count(Child))>>
blah …
<<End()>>

See the Cookbook article Working with repeated elements for more information on repeated data elements.

Leave a Reply