# Module unique\_in\_loop inside nested for loop

**URL:** <https://community.hubspot.com/t/module-unique-in-loop-inside-nested-for-loop/9219>\
**Category:** CMS Development\
**Created:** [June 21, 2018, 3:14pm UTC](https://community.hubspot.com/t/module-unique-in-loop-inside-nested-for-loop/9219 "2018-06-21T15:14:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vin-aws](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vin-aws/32/13521_2.png) [@vin-aws](https://community.hubspot.com/u/vin-aws)\
**Post date:** [June 21, 2018, 3:14pm UTC](https://community.hubspot.com/t/module-unique-in-loop-inside-nested-for-loop/9219/1 "2018-06-21T15:14:56Z")

</div>

Trying to create a table of columns and rows with rich text modules.

```auto
<div class="table-container">
 {% for i in range(widget.number_of_columns|int) %}
 <div class="col">
 <h1>{% rich_text "header" value="Header", label="Header", no_wrapper=True, unique_in_loop=True %}</h1>
 <h3>{% rich_text "price" value="$100", label="Price", no_wrapper=True, unique_in_loop=True %}</h3>
 {% for j in range(widget.number_of_rows|int) %}
 <div class="row">
 {% rich_text "item" value="List Item", no_wrapper=True, unique_in_loop=True %}
 </div>
 {% endfor %}
 </div>
 {% endfor %}
</div>

```

Any way to make the inner row rich\_texts unique? They are appearing as the same for each column.

---

<div class="post-metadata">

**Author:** ![tjoyce](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tjoyce/32/88832_2.png) [@tjoyce](https://community.hubspot.com/u/tjoyce)\
**Post date:** [June 21, 2018, 4:06pm UTC](https://community.hubspot.com/t/module-unique-in-loop-inside-nested-for-loop/9219/2 "2018-06-21T16:06:07Z")

</div>

Good Question. I hate to say it’s not possible but… it’s not possible to interpolate names in the HUBL module definitions. It’s also not possible to pass anything other than boolean values to unique in loop. Perhaps you could run each loop without nesting them and then use javascript to move the elements into the correct places? I know that’s a stretch but there are limited solutions.

* * *

[tim@belch.io](mailto:tim@belch.io)

---

<div class="post-metadata">

**Author:** ![vin-aws](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vin-aws/32/13521_2.png) [@vin-aws](https://community.hubspot.com/u/vin-aws)\
**Post date:** [June 21, 2018, 4:14pm UTC](https://community.hubspot.com/t/module-unique-in-loop-inside-nested-for-loop/9219/3 "2018-06-21T16:14:17Z")

</div>

Yeah I will probably have to move elements with javascript but even then my options are limited as I want the user to be able to choose the number of rows for each column…So somehow I still need a nested loop

---

<div class="post-metadata">

**Author:** ![vin-aws](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vin-aws/32/13521_2.png) [@vin-aws](https://community.hubspot.com/u/vin-aws)\
**Post date:** [June 21, 2018, 7:49pm UTC](https://community.hubspot.com/t/module-unique-in-loop-inside-nested-for-loop/9219/4 "2018-06-21T19:49:39Z")

</div>

What I did to solve this problem was make each table column its own custom module and which looped and allowed user to enter number of rows. In the big table module itself it loops and allows user to pick number of columns which then inserts that number of custom modules of columns.
