Solved

Dynamic table: doubling data

  • 23 January 2023
  • 5 replies
  • 150 views

Badge +2

Probably doing something wrong but I’m trying to create a dynamic table for order confirmation emails. I was almost done until I previewed orders with multiple products. This has now doubled loads of my tags - I’m imagining it has something to do with the fact that the tag is probably related to the one product (rather than possibly the full order)? Here’s some screenshots. 

I've tried to cover up details for GDPR but hopefully it’s obvious that things are doubling up - I managed to get the products in single file. Any help would be great!

icon

Best answer by stephen.trumble 24 January 2023, 17:12

View original

5 replies

Userlevel 7
Badge +60

Hey @lisaspencer 

Really great question about using a dynamic table block in the classic template editor!

In the article I linked above there is a step that was missed when creating the table block, but is an easy fix.

Once you set the data source for the table block, you then navigated to one of the columns and then pasted the full event variable you want to display correct? The next step is to replace the collection for the variable (the text you used for the Row Collection) and the following number with the Row Alias (e.g., item)

For this example, {{ event.extra.items.0.subtotal }} now becomes {{ item.subtotal }} . Fixing this should resolve the issue you are seeing with duplicate info.

 

Hope this helps!

Badge +2

Yeah I tried that but still didn’t work - the only thing I can see that isn’t helping is that there is no array number for the subtotal in the tags, so you can’t do that above step. My newest issue is now its not just doubling but its repeating like 20 times over and over! I don’t know how to fix this!

 

I've managed to keep the product items and price (and also billing information) just only once because they had array numbers so I followed the steps in the guides to remove them and replace the row alias. But can’t figure out why its now repeating 20+ times on all the other ones!

 

Userlevel 7
Badge +60

Hey @lisaspencer 

Sorry the first suggestion doesn’t work. The next thing I would suggest trying is to set the table to static while using the template tags you have in place. I think the dynamic setting is putting it through the repeat function which is unnecessary as these template tags only have one for each item you are trying to share (ie there is no number in the tag to replace). Give that a try and let me know how it goes!

Badge +2

Perfect! So if there’s an array in the tag, we should use the Dynamic table but if it’s a one-off tag that has no array number, then we should use the full tag in Static.

 

Thank yoU!

Userlevel 7
Badge +60

@lisaspencer 

Woohoo! I’m glad we got it to work! Thanks for sharing this with the community!

Reply