Need some help to write a condition on below expressions with loop.
Please help us to write a condition to print “NO DATA” in a row when there is no schedules or schedules length/size==0.
AND
Please help us to write a condition to print only 50 rows even if there are 50+ rows in schedules.
FYI,
<ctx>
<schedulePaymentData>
<schedule>...</schedule>
<schedule>...</schedule>
...
</schedulePaymentData>
</ctx>
<table border="1" cellpadding="4" cellspacing="0">
<tr>
<th>Payment date</th>
<th>Payment amount</th>
</tr>
<%
// rtEvent is injected automatically in Message Center templates
// rtEvent.ctx is the XML payload from your SOAP <ctx> element
// This returns all <schedule> child nodes
var schedules = rtEvent.ctx.schedulePaymentData.schedule;
// Campaign-specific E4X loop over XML collection
for each (var s in schedules) {
// Extract and normalize the values as strings
var payDate = String(s.schedulePaymentDate).trim();
var payAmount = String(s.schedulePaymentAmount).trim();
%>
<tr>
<td><%= payDate %></td>
<td><%= payAmount %></td>
</tr>
<%
}
%>
</table>