# Addressing looped items in nested groups

**URL:** <https://community.hubspot.com/t/addressing-looped-items-in-nested-groups/22501>\
**Category:** CMS Development\
**Tags:** design-manager\
**Created:** [July 6, 2020, 1:35pm UTC](https://community.hubspot.com/t/addressing-looped-items-in-nested-groups/22501 "2020-07-06T13:35:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_eon](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/daniel_eon/32/77566_2.png) [@Daniel\_eon](https://community.hubspot.com/u/Daniel_eon)\
**Post date:** [July 6, 2020, 1:35pm UTC](https://community.hubspot.com/t/addressing-looped-items-in-nested-groups/22501/1 "2020-07-06T13:35:24Z")

</div>

Hi everyone,

I am trying to reverse-engineer some modules in the Design Manager that an agency did for us and make changes to them, so I am not too familiar with HubL yet and am reading through the developer documentation as I go.

This one is a carousel module, based on the bootstrap carousel. To add more slides, the carousel-item-class is looped. I added some optional CSS gradient overlay controls to the looped image slide, which works fine.

```auto
 {% for item in module.slide %}

 <div class="carousel-item-{{loop.index}} carousel-item{% if loop.first %} img-fluid active{% endif %}" data-interval="{{ item.slide_duration *1000 }}" style="background-image: 
 {% if item.overlay_gradient %}
 linear-gradient(
 {% if item.gradient_direction != 'custom' %} 
 {{ item.gradient_direction }}
 {% else %} 
 {{ item.custom_direction }}deg
 {% endif %}, rgba({{ item.gradient_first_color.color|convert_rgb }}, {{ item.gradient_first_color.opacity / 100 }}), rgba({{ item.gradient_second_color.color|convert_rgb }}, {{ item.gradient_second_color.opacity / 100}})),
 {% endif %}
 url({{ item.image_slider.src }});background-size: cover;background-position: center;">
 {% if item.link %}<a class="carousel-item-link" href="{{item.link}}"></a> {% endif %} 

```

The looped carousel-item is put into a module subgroup called “slide”. Within this slide subgroup, I would like to create another subgroup “gradient\_settings” (hence a nested group) for just the gradient controls. But then, I don’t know how to correctly address the items in the nested group with HubL. I tried various combinations, e.g.

- item.gradient\_settings.gradient\_first\_color.color
- item.slide.gradient\_settings.gradient\_first\_color.color
- module.item.slide.gradient\_settings.gradient\_first\_color.color
- module.slide.gradient\_settings.gradient\_first\_color.color

etc., but none of these work.

How do I need to address items in HubL with this hierarchy?  
Module - looped “slide group” - Nested “gradient\_settings group” within the looped “slide group” - single item?

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![sharonlicari](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sharonlicari/32/101479_2.png) [@sharonlicari](https://community.hubspot.com/u/sharonlicari)\
**Post date:** [July 8, 2020, 10:47am UTC](https://community.hubspot.com/t/addressing-looped-items-in-nested-groups/22501/2 "2020-07-08T10:47:08Z")

</div>

Hey [@Daniel\_eon](https://community.hubspot.com/t5/user/viewprofilepage/user-id/137700)

Thank you for the information provided. I’ll tag a few experts that can share their knowledge with you.

Hey @FabianRichter @John @DavidFJones could you please share your thoughts with [@Daniel\_eon](https://community.hubspot.com/t5/user/viewprofilepage/user-id/137700)?

Thanks

Sharon

---

<div class="post-metadata">

**Author:** ![Daniel\_eon](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/daniel_eon/32/77566_2.png) [@Daniel\_eon](https://community.hubspot.com/u/Daniel_eon)\
**Post date:** [July 8, 2020, 11:13am UTC](https://community.hubspot.com/t/addressing-looped-items-in-nested-groups/22501/3 "2020-07-08T11:13:56Z")

</div>

Hi Sharon,

thank you, much appreciated 🙂

---

<div class="post-metadata">

**Author:** ![John](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/john/32/43512_2.png) [@John](https://community.hubspot.com/u/John)\
**Post date:** [July 8, 2020, 12:22pm UTC](https://community.hubspot.com/t/addressing-looped-items-in-nested-groups/22501/4 "2020-07-08T12:22:01Z")

</div>

a screenshot of the module fields might help us wrap our head around what you are asking

---

<div class="post-metadata">

**Author:** ![Daniel\_eon](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/daniel_eon/32/77566_2.png) [@Daniel\_eon](https://community.hubspot.com/u/Daniel_eon)\
**Post date:** [July 15, 2020, 12:36pm UTC](https://community.hubspot.com/t/addressing-looped-items-in-nested-groups/22501/5 "2020-07-15T12:36:34Z")

</div>

Hi John,

thanks for the reply. So here is what the module structure /hierarchy looks like currently and which works with the code posted above:

 ![29259i93B607C561FD9E76.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/6/1/613726f2783d08445889361a245ed39e476c7048.jpeg)

And here is what I would like to do. As soon as I move controls in a nested group, the above code no longer works, as the path to the controls changes.

 ![29260i39BC5BA9F7E50023.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/1/41af1f3cd61ae0f728fb3c0e667748efea5ab0d2.jpeg)

---

<div class="post-metadata">

**Author:** ![vish891](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vish891/32/97222_2.png) [@vish891](https://community.hubspot.com/u/vish891)\
**Post date:** [July 12, 2020, 2:16pm UTC](https://community.hubspot.com/t/addressing-looped-items-in-nested-groups/22501/6 "2020-07-12T14:16:57Z")

</div>

Pls try this

item.gradient\_first\_color.color

---

<div class="post-metadata">

**Author:** ![Daniel\_eon](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/daniel_eon/32/77566_2.png) [@Daniel\_eon](https://community.hubspot.com/u/Daniel_eon)\
**Post date:** [July 15, 2020, 12:37pm UTC](https://community.hubspot.com/t/addressing-looped-items-in-nested-groups/22501/7 "2020-07-15T12:37:35Z")

</div>

Hi vish,

thanks for the suggestion. This is how the items are currently addressed in the code, and this works fine. But that stops working once you put the items in a nested group.

---

<div class="post-metadata">

**Author:** ![vish891](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vish891/32/97222_2.png) [@vish891](https://community.hubspot.com/u/vish891)\
**Post date:** [July 15, 2020, 2:22pm UTC](https://community.hubspot.com/t/addressing-looped-items-in-nested-groups/22501/8 "2020-07-15T14:22:59Z")

</div>

Hey

Had created the same setup and i could access it with the code i sent.

 ![29270i90ECAD3C3B4E32F6.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/6/7/67e5b4d71f1675e221ac8ac09613230a1d4896d7.jpeg)

---

<div class="post-metadata">

**Author:** ![MGheibi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mgheibi/32/75363_2.png) [@MGheibi](https://community.hubspot.com/u/MGheibi)\
**Post date:** [November 9, 2022, 1:03pm UTC](https://community.hubspot.com/t/addressing-looped-items-in-nested-groups/22501/9 "2022-11-09T13:03:05Z")

</div>

Hello

you can use:

{% for item in module.FirstStepFieldGroup.SecondStepFieldGroup %}

{{item}} that you need

{% endfor %}
