adding loop.index to variable nameSOLVE
Oct 24, 2019 2:59 AM - edited Oct 24, 2019 4:34 AM
what is the correct syntax for adding the number of the current iteration inside a loop to the name of a variable?
We have a custom module (for an email template) with a group of elements that can be added multiple times.
Every group (so every iteration) needs a variable with a different value.
set int_var1 = 200
set int_var2 = 400
I tried connecting the variable with loop.index using ~ but it only
shows the iteration.
any help is much appreciated
Solved! Go to Solution.
Oct 28, 2019 4:24 PM
Not certain exactly what you're trying to do, but seems like you could just use a dict. then you can set the keys to whatever string you want. Essentially mimicking the functionality you're wanting, in a safer way.
Sr. CMS Developer Advocate
- Get started developing on the HubSpot CMS
- Developer Changelog
- Creating an efficient CMS Development workflow
- CMS Developer Tutorials
- How to optimize your CMS Hub site for speed
If my reply answered your question, please mark it as a solution, to make it easier for others to find.