Yep. I think you inadvertently created an extra loop. It's quite easy to do in Power Automate. If you click the wrong thing, it automatically creates another Apply to Each for you.
I published the form and made a quick flow, and I go the expected two loops.
Now, for the second comment you made regarding duplicates. After I started looking at this, I realized that this was my first time automating a nested repeat from S123 within Power Automate! With some pondering, I finally realized what is going on. Essentially, all of the nested repeat's children are contained within a single large group. So, when it loops through each of your parent repeat items, it adds the total number of children within your survey for each parent (e.g., if you submit a survey with two parents and five children, total, you will end up with 10 rows).
As a result, we need to tell Power Automate what to filter out so it doesn't create duplicates. Luckily, this is pretty simple: Inside your nested repeat, use a Condition to compare the parent's uniquerowid to the child's parentrowid, then put your tasks into the Yes side of the Condition.
This is a separate item...
I am not sure what your process in Power Automate is, but I like to parse the JSON of my initial response and then work with that. I find it makes things much easier than trying to guess what field I am selecting. This is why my flow above likely looks a little different than yours. I will lay out the steps I did below just in case you find them helpful.
1. Set up a Trigger When a survey response is submitted
2. Add a ParseJSON > click "Generate from sample" > paste in the below code > click "Done". (The below code is nearly complete, but I trimmed a few things from the main body since I was just testing the repeats).
{
"feature": {
"attributes": {
"land_use": null,
"landowner": null,
"observers": null,
"origin_season": null,
"watershed": null
},
"result": {
"objectId": null
},
"repeats": {
"species_group_repeat": [
{
"attributes": {
"plot_description": null,
"species": null,
"transect_plot": null,
"notes": null,
"uniquerowid": null
},
"repeats": {
"plant": [
{
"attributes": {
"cage": null,
"health": null,
"micro_topograpphy": null,
"tube": null,
"parentrowid": null
}
}
]
}
}
]
}
},
"surveyInfo": {
"formItemId": null,
"formTitle": null,
"serviceItemId": null,
"serviceUrl": null
},
"portalInfo": {
"url": null,
"token": null
},
"userInfo": {
"username": null,
"firstName": null,
"lastName": null,
"fullName": null,
"email": null
}
}
3. Add a Condition. For the first value, add uniquerowid
4. For the second value, add parentrowid
5. At each step of #3 and #4 above, the Apply to each will be added for you automatically. Now, just add your data operations to the "Yes" side of the Condition.
In the end, I got the proper number of items from the nested repeat and only two Apply to Each loops.