Loop within a loop

You can't add a loop within a loop, but this recipe demonstrates a workaround.

By NetDocuments

Start app

How to "nest" loops

You can't have a loop within a loop (known as "nested" loops), but there is a workaround that allows you to achieve the same effect. That workaround is:

  • Use two loops; then
  • In the second loop, allow the end-user to assign each loop member to one of the members from the first loop.

This recipe demonstrates how to use this pattern for the following context:

  • A loop to collect a list of children; then
  • A second loop to collect a list of grandchildren. For each grandchild, you can specify which child they belong to.

Allowing the end-user to specify which child a grandchild belong to requires a special step -- duplicate this recipe to see how it's done!

Get this app

Total cost


Federal / National
Areas of law