Search code examples
breaknvelocity

NVelocity - print a record based on a condition


i'm trying to print a record in NVelocity based on certain condition:

Below is the snippet... basically, Loop through the Addresses Object and if the current AdType is the "Current Address", print it and then exit out of the loop ...

I'm getting "#break" in my output html... as if it is ignoring it..

I have version 1.1.1 of NVelocity

Thanks

     #foreach($spAddress in $Report.Spouse.Addresses)
         #if( $spAddress.AdType == "Current Address")
    <tr>
        <td width="23%">
            <font size="2"><strong>$spAddress.AdType :</strong></font>
        </td>
        <td width="75%">
            <font size="2">$spAddress.CivicNumber, $spAddress.StreetName,$spAddress.City, $spAddress.Province, $spAddress.PostalCode</font>
        </td>
    </tr>
        #break
        #end
    #end

Solution

  • I implemented #break about a year ago, but it's not in any released version yet. You can get it from the Monorail2 repository. Give it a try and let us know if you find any bugs.