Skip to content

MvFOREACHSTOP#


An loop can be explicitly halted using the tag to exit the loop. Execution jumps to the code following the closing tag.

syntax
<MvFOREACHSTOP> 

Example#

This examples loops through the orders array. The <MvFOREACHSTOP> tag is used to exit the loop if an expected
field is null.

<MvFOREACH ITERATOR = "l.item" ARRAY = "l.orders" INDEX = "l.pos" COUNT = "{ 100 }">

    <MvCOMMENT> If this field is empty display an error and exit the loop. </MvCOMMENT>
    <MvIF EXPR="{ ISNULL l.item:code }">
        <MvEVAL EXPR="{ 'Error in order number ' $ l.item:id $ '. code not found.' }">
    <MvFOREACHSTOP> 

</MvFOREACH>