hello currently working on an email that has table and the records are coming from another DE so im using LookupRows using contactId, I want to limit the number of records to be displayed to 5 however when i manually hardcode for @i = 1 to 5 Im getting an error because of those records who have lesser rows
ie
ContactId - Orders (no of rows)
I hope someone would guide me, Thank you
%%[
set @rows = LookupRows("Data extension name","ContactId", @contactId)
for @i = 1 5 do
set @row = Row(@rows, @i)
set @orderNumber = Field(@row, "Order Number")
set @orderDate= Field(@row, "Order Date") ]%%
<tr>
<td%%=v(@orderNumber)=%%</td>
<td%%=v(@orderDate)=%%</td>
</tr>
%%[next @i]%%