Explicit Processing of Collections and Content Filtering
In some cases, you may want to filter the output data so that only a subset of the issues in a tracker are exported. For example, if you want to export only the issues that were created today or yesterday, process all issues using an
jt:forEach iterator tag explicitly, and filter the exported issues using a
jt:if tag.
The template should look similar to the following
Id
|
Name
|
...more..data...
|
|
<jt:forEach items="${items}" var="item"><jt:if test="${item.submittedAt.after(yesterday)}">${item.id}
|
${item.name}
|
...
|
|
In the above example, the jt:forEach tag iterates over all issues in the items collection (exported issues) and then repeats all cells between the start and end of the jt:forEach tag. The current issue is exposed as an item variable, so the cells inside the jt:forEach should refer to issue properties using that.
The jt:if tag is used to filter the items that are added using a simple logic expression. item.submittedAt contains the submit date of the issue, and yesterday is a date constant that always refers to the start (12:00 AM) of yesterday. Elements inside the jt:if tag appear only if the condition is true.