Forums/How Do I ... ?

Is it possible to apply a condition to a w:for_each loop?

Cindy
posted this on March 15, 2013, 16:30

I have two CIT's:  Awards and Entries.  I've set the Entries up as a related item in the Award CIT.   I only want to show entries with status value == 'finalist' and award year == '2013'.  Here's an example:

<w:name />
  <w:for_each in="entries" condition="in.status=='finalist' && in.year == '2013''">
    <w:get name='in.name' /><w:get name='in.status' />
  </w:for_each>
</w:kb:item:each>

 

Comments

User photo
Andrew DesChenes
Webvanta Help Desk

 

Cindy,

The for_each tag does not support conditions.  You will have to use a condition INSIDE the for_each loop  to filter your results.

w:for_each

       w:if condition="in.status=='finalist'&&in.year=='2013"

            do something

      /w:if

/w:for_each

 

 

 

 

 

 

 

 

 

 

 

March 21, 2013, 17:29