Edit Content
Click on the Edit Content button to edit/add the content.

The ScriptIf function – XpressDox

The XpressDox ScriptIf function

First, read through the article on Scripts to familiarize yourself with that feature.

Using a condition inside a parameterized script requires the use of ScriptIf rather than If. The matching End for a ScriptIf, is a ScriptIfEnd().

It is worth copying-and-pasting this example into a template and trying it out. Note that in the example, the Required and second Rule commands are generated conditionally using the ScriptIf.


«Comment(This is a kind of generic “Limit the number of repeaters”, at the same time parameterising whether there is a minimum number.)»
«Rule(&RepeaterName&,hard,count(&RepeaterName&) <= &MaximumNumber&, ‘No more than &MaximumNumber& &RepeaterDescription& are allowed.’)»
«ScriptIf(&MinimumNumber& > 0)»
«ScriptIf(&MinimumNumber& > 1)»
«Rule(&RepeaterName&,hard,count(&RepeaterName&) >= &MinimumNumber&, ‘You need at least &MinimumNumber& &RepeaterDescription&’)»
«OnEnterSet(&RepeaterName&/&FirstRepeaterElement&,&FirstRepeaterElement&,Value,(PositionOfRepeater() > &MaximumNumber&),'No! Do not enter more than &MaximumNumber& &RepeaterDescription&.')»


Table of Contents