Mashups in EMML : Writing Mashups in EMML : Controlling Mashup Processing Flow : <while> : <while> Example
<while> Example
You must specify the condition that must be true for the <while> loop to process. Then add statements, as needed, within <while>. For example:
<variables>
<variable name="orders" type="document"/>
<variable name="subtotal" type="number"/>
<variable name="taxes" type="document"/>
</variables>
...
<foreach variable="order" items="$orders//invoice">
<while condition="$order/item/tax > 0">
<appendresult outputvariable="$taxes">
<res:order>
<res:id>{$order/invoiceNo)}</res:id>
<res:item>{$order/item/itemNo}</res:item>
<res:tax>{$order/item/tax}</res:tax>
</res:order>
</while>
</appendresult>
</for>
You can also set the condition to always be true and then explicitly break out of the loop. For an example, see the <break> statement.
Working Samples
The WhileSample (while.emml) sample mashup use the <while> statement. See Mashup Samples for a list of MashZone NextGen mashup samples and where to find them.
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback