Need some help to write a condition on below expressions with loop. | Community
Skip to main content
Level 1
March 17, 2026
Question

Need some help to write a condition on below expressions with loop.

  • March 17, 2026
  • 1 reply
  • 8 views

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>

    1 reply

    Nolan_Chabert
    Adobe Employee
    Adobe Employee
    March 17, 2026

    Hi ​@AjayBo1 

    did you try to use the if tatement wit hthe size of your var s? and apply a else with <td> no data.

    Thanks 

    Nolan