CMS Development

Farid
Participant | Platinum Partner
Participant | Platinum Partner

Loop a group inside another loop group

SOLVE

Hi,

I am wondering if it's possible to loop a group inside the looped parent group.

I get this error

Farid_0-1611855120548.png

Please help me how can I do it

 

Thanks in forward

Kind regards

Farid

0 Upvotes
1 Accepted solution
piersg
Solution
Key Advisor

Loop a group inside another loop group

SOLVE

Hi @Farid you just need to use a nested for loop:

 

{% set fils = module.fil %}
{% for fil in fils %}
  {{ fil.filter_title }}
  {% for accordion in fil.accordion %}
  ..
    {# accordion code here #}
  ..
  {% endfor %}
{% endfor %}

 

View solution in original post

4 Replies 4
piersg
Solution
Key Advisor

Loop a group inside another loop group

SOLVE

Hi @Farid you just need to use a nested for loop:

 

{% set fils = module.fil %}
{% for fil in fils %}
  {{ fil.filter_title }}
  {% for accordion in fil.accordion %}
  ..
    {# accordion code here #}
  ..
  {% endfor %}
{% endfor %}

 

Farid
Participant | Platinum Partner
Participant | Platinum Partner

Loop a group inside another loop group

SOLVE

Hi @piersg 
Thank you so much. Your codes work well (y)

Best regards

Farid

dennisedson
HubSpot Product Team
HubSpot Product Team

Loop a group inside another loop group

SOLVE

Hey @Farid 

Could you post more of your code?  The yellow indicates a warning, not an error

@Bryantworks@Anton can you all lend a hand 🤙

 

0 Upvotes
Farid
Participant | Platinum Partner
Participant | Platinum Partner

Loop a group inside another loop group

SOLVE

Hi @dennisedson 

 

Yes, sure! Here are other screens from my job.

Farid_3-1611910991863.png

Farid_4-1611911020880.png

 

Actually, my goal is to have a group of filters, which each filter has a group of accordions inside. In this case, Filter Group has a loop that works fine and an accordion group inside the filter group has also loop and shows nothing in output.

Farid_1-1611910789741.png

Farid_7-1611911305231.png

 

Farid_5-1611911106175.pngFarid_6-1611911146020.png

Please tell me if it's possible at all to have a repeat group inside another repeated group.

Thanks in forward

My best regards

Farid

 

0 Upvotes