- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
adding loop.index to variable name
SOLVEOct 24, 2019 2:59 AM - edited Oct 24, 2019 4:34 AM
Hi,
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.
for example:
set int_var1 = 200
next iteration:
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Accepted Solutions
Oct 28, 2019 4:24 PM
Hi Hani,
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.
https://designers.hubspot.com/docs/hubl/hubl-variables-and-macros-syntax
https://developers.hubspot.com/changelog/new-feature-new-list-operations
Jon McLaren
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content