Email Loop in ACS
I have a query resulting in multiple lines that I need to display in an email to then send it to the rcpManager which is the profile I need to send the email to.
| facilityId | Name | Addr1 | Addr2 | Phone | managerCode | rcpManager | |
| 123 | Joe's Garage | Lorem | Dolor | joe@garage.com | 12345 | 5 | manager@adobe.com |
| 456 | Car Express | Ipsum | Sit Amet | car@express.com | 6778 | 5 | manager@adobe.com |

Now, I need to display these in an email using a loop, but it doesnt seem to work for me?
<% for (var i =0;i<=context.targetData.length;i++) { %>
<!---somehtml tables and columns here--->
<%= context.targetData[i].facilityId%> </span>
<%= context.targetData[i].name%> </span>
<%= context.targetData[i].Addr1%> </span>
<%}%>
If I try to get the length of targetData it comes back as undefined
`<%= context.targetData.length %>` --> undefined
If I get the length of facilityId its fine.so how do I iterate through all the rows?
`<%= context.targetData.facilityId.length %>` --> 8
What would be the correct way?