Skip to main content
Solved

When & how to loop over event data

  • September 6, 2023
  • 2 replies
  • 661 views

Forum|alt.badge.img+3
  • Contributor III
  • 5 replies

I am trying to return event data that could be anywhere from 1 to 5 items, I want each one to populate in a bulleted list but I only want the bullet to show up if there is an associated event (ie. if theres only 1 item for someone, I don’t want 4 blank bullet points under that 1 item). Does looping achieve this? If so, what is the code I would use for that?

Here is an example of the list I am trying to populate that has variable number of values returned back on the person. 

 

Best answer by JessFosnough

Hi @MZeeb,

If you put your bullet point inside a dynamic table and loop, then it should only show up if there is event data. For example, we have an Abandoned checkout email that loops over with the items in the customer’s cart. Our table looks like this:

 

 

We don’t actually have bullets in our email, but I tested it by putting bullets before the item number and price, and it seemed to work. Our table also has an event slice, so that it only shows 5 items in their cart. When setting this up, I found this article on template tags and this one on building dynamic blocks in a flow to be very hepful.

Best of luck!

View original
Did this topic or the replies in the thread help you find an answer to your question?

2 replies

JessFosnough
Expert Problem Solver IV
Forum|alt.badge.img+23
  • Expert Problem Solver IV
  • 194 replies
  • Answer
  • September 6, 2023

Hi @MZeeb,

If you put your bullet point inside a dynamic table and loop, then it should only show up if there is event data. For example, we have an Abandoned checkout email that loops over with the items in the customer’s cart. Our table looks like this:

 

 

We don’t actually have bullets in our email, but I tested it by putting bullets before the item number and price, and it seemed to work. Our table also has an event slice, so that it only shows 5 items in their cart. When setting this up, I found this article on template tags and this one on building dynamic blocks in a flow to be very hepful.

Best of luck!


Forum|alt.badge.img+3
  • Problem Solver I
  • 34 replies
  • September 6, 2023

You can also do this kind of thing dynamically using AMP and interactive HTML like Zaymo does. That way the event data stays up to date with your store as well (out of stock, prices, images, etc)