WSO2 BPS - Sample Guide - Repeat Until

Sample Guide - Repeat Until

Table of Content


Objective

Explains the functionality of <repeatUntil/> construct, where the repetitive task should be executed at least once. This functionality also can be achieved via <while/>. But how the logical condition used in both cases differs.


Prerequisites


Overall Idea

Refer TestRepeatUntil.zip

eg -

<repeatUntilname="RepeatUntil"><assignvalidate="no"name="IncrementCounter"><copy><from><![CDATA[$counter + 1]]></from><tovariable="counter"></to></copy></assign><condition><![CDATA[$counter >= 10]]></condition></repeatUntil>

Here we increment counter variable until it's equal to 10.

If you refer TestWhile.zip, the logical condition in <while/> is exactly the negation used in <repeatUntil/> to do the same thing.

eg -

<whilename="While"><condition><![CDATA[$counter < 10]]></condition><assignvalidate="no"name="IncrementInput"><copy><from><![CDATA[$counter + 1]]></from><tovariable="counter"></to></copy></assign></while>