<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Nested Repeats in Microsoft Power Automate, Survey123 Connect in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1359842#M53400</link>
    <description>&lt;P&gt;Two questions. 1) Have you swapped out of AI mode to see what is actually being referenced in the For Each? You can do that clicking the ellipses (...) in the top right. (Personally, I really don't like that AI assistant. It can make simple tasks difficult), and 2) Can you upload the XLSX? I'm actually not sure off-hand why you have three For Each.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Dec 2023 18:58:01 GMT</pubDate>
    <dc:creator>abureaux</dc:creator>
    <dc:date>2023-12-12T18:58:01Z</dc:date>
    <item>
      <title>Nested Repeats in Microsoft Power Automate, Survey123 Connect</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1359819#M53395</link>
      <description>&lt;P&gt;Hello ESRI Community!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know how to deal with nested repeats in Microsoft Power Automate?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here was my process:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1)&amp;nbsp; I coded a survey in Survey123 Connect (version 3.19.104.0) (see XLSForm below).&lt;/P&gt;&lt;P&gt;2)&amp;nbsp; I used the "When a survey123 response is submitted" flow trigger in Microsoft Power Automate.&lt;/P&gt;&lt;P&gt;3)&amp;nbsp; I used the "Add a Row" function to send data from my survey to an online Excel table. (see photo of flow below).&lt;/P&gt;&lt;P&gt;The survey has two levels of repeat ("plant" within "species_group_repeat"). When I tried to create a flow with the nested repeat, it created three "for each" loops (photo below). In the spreadsheet the data is mostly there but each response is entered multiple times.&amp;nbsp;&lt;SPAN&gt;I've successfully done the above process with one repeat, but never with nested repeats. Does anyone know how to fix this?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance for any insight!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sammy_SalmonNSEA_1-1702403175005.png" style="width: 644px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/88783iD97E5B351E0FBEF0/image-dimensions/644x471?v=v2" width="644" height="471" role="button" title="Sammy_SalmonNSEA_1-1702403175005.png" alt="Sammy_SalmonNSEA_1-1702403175005.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Sammy_SalmonNSEA_1-1702403175005.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;XLSForm&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Sammy_SalmonNSEA_0-1702403053164.png" style="width: 844px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/88782i4ACF5EA7254C87B8/image-dimensions/844x597?v=v2" width="844" height="597" role="button" title="Sammy_SalmonNSEA_0-1702403053164.png" alt="Sammy_SalmonNSEA_0-1702403053164.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Sammy_SalmonNSEA_0-1702403053164.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;MPA Flow&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 18:29:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1359819#M53395</guid>
      <dc:creator>Sammy_SalmonNSEA</dc:creator>
      <dc:date>2023-12-12T18:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Repeats in Microsoft Power Automate, Survey123 Connect</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1359842#M53400</link>
      <description>&lt;P&gt;Two questions. 1) Have you swapped out of AI mode to see what is actually being referenced in the For Each? You can do that clicking the ellipses (...) in the top right. (Personally, I really don't like that AI assistant. It can make simple tasks difficult), and 2) Can you upload the XLSX? I'm actually not sure off-hand why you have three For Each.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 18:58:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1359842#M53400</guid>
      <dc:creator>abureaux</dc:creator>
      <dc:date>2023-12-12T18:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Repeats in Microsoft Power Automate, Survey123 Connect</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1359896#M53405</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/454586"&gt;@abureaux&lt;/a&gt;, thank you for your response!&lt;/P&gt;&lt;P&gt;I'll try switching out of AI mode, hopefully that will solve the issue. I've attached the XLSForm.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 20:12:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1359896#M53405</guid>
      <dc:creator>Sammy_SalmonNSEA</dc:creator>
      <dc:date>2023-12-12T20:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Repeats in Microsoft Power Automate, Survey123 Connect</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1359898#M53406</link>
      <description>&lt;P&gt;Thanks. I'll toss it in and have a quick look.&lt;/P&gt;&lt;P&gt;And just to be clear, swapping out of (or into) AI mode won't necessarily fix (or break) anything, it's just that the "normal" mode (aka, not the AI mode) can give you a more clear and intuitive picture of what is actually going on.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 20:14:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1359898#M53406</guid>
      <dc:creator>abureaux</dc:creator>
      <dc:date>2023-12-12T20:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Repeats in Microsoft Power Automate, Survey123 Connect</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1359989#M53409</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/454586"&gt;@abureaux&lt;/a&gt;&amp;nbsp;, thank you for taking a look!&lt;/P&gt;&lt;P&gt;Here's a look at the flow in classic mode. The dynamic text is the same in "For each- A" and "For each- B":&amp;nbsp; &amp;nbsp;&lt;EM&gt;triggerBody()?['body']?['feature']?['repeats']?['species_group_repeat']&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The dynamic text in "For each- C" is:&amp;nbsp;&lt;EM&gt; items('for each- B')?['repeat']?['plant']&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I wonder if MPA somehow created an extra loop?&lt;/P&gt;&lt;P&gt;The yellow-highlighted fields correspond to the questions in the "species_group_repeat" and the blue-circled fields correspond to questions in the "plant" repeat.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sammy_SalmonNSEA_1-1702416652694.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/88813i339A528A7900CE3D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Sammy_SalmonNSEA_1-1702416652694.png" alt="Sammy_SalmonNSEA_1-1702416652694.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Sammy_SalmonNSEA_1-1702416652694.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 21:46:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1359989#M53409</guid>
      <dc:creator>Sammy_SalmonNSEA</dc:creator>
      <dc:date>2023-12-12T21:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Repeats in Microsoft Power Automate, Survey123 Connect</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1360071#M53411</link>
      <description>&lt;P&gt;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 &lt;EM&gt;Apply to Each&lt;/EM&gt; for you.&lt;/P&gt;&lt;P&gt;I published the form and made a quick flow, and I go the expected two loops.&lt;/P&gt;&lt;P&gt;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 &lt;EM&gt;each&lt;/EM&gt; parent (e.g., if you submit a survey with two parents and five children, total, you will end up with 10 rows).&lt;/P&gt;&lt;P&gt;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 &lt;EM&gt;Condition&lt;/EM&gt; to compare the parent's &lt;STRONG&gt;uniquerowid&lt;/STRONG&gt; to the child's &lt;STRONG&gt;parentrowid&lt;/STRONG&gt;, then put your tasks into the &lt;EM&gt;Yes&lt;/EM&gt; side of the &lt;EM&gt;Condition&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_1-1702420458699.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/88827i456B48B28D5CD4DA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_1-1702420458699.png" alt="abureaux_1-1702420458699.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;abureaux_1-1702420458699.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;This is a separate item...&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;1. Set up a Trigger &lt;EM&gt;When a survey response is submitted&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;2. Add a &lt;EM&gt;ParseJSON &amp;gt; &lt;/EM&gt;click "Generate from sample" &amp;gt; paste in the below code &amp;gt; 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).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
  "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
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;3. Add a &lt;EM&gt;Condition. &lt;/EM&gt;For the first value, add &lt;STRONG&gt;uniquerowid&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_4-1702421357862.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/88831i11201C238FB2913F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_4-1702421357862.png" alt="abureaux_4-1702421357862.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;abureaux_4-1702421357862.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;4. For the second value, add &lt;STRONG&gt;parentrowid&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_3-1702421345552.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/88830i5F9D16D616D923E4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_3-1702421345552.png" alt="abureaux_3-1702421345552.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;abureaux_3-1702421345552.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;5. At each step of #3 and #4 above, the &lt;EM&gt;Apply to each&lt;/EM&gt; will be added for you automatically. Now, just add your data operations to the "Yes" side of the &lt;EM&gt;Condition&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;In the end, I got the proper number of items from the nested repeat and only two &lt;EM&gt;Apply to Each&lt;/EM&gt; loops.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 22:57:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1360071#M53411</guid>
      <dc:creator>abureaux</dc:creator>
      <dc:date>2023-12-12T22:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Repeats in Microsoft Power Automate, Survey123 Connect</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1360535#M53437</link>
      <description>&lt;P&gt;Amazing! Thank you,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/454586"&gt;@abureaux&lt;/a&gt;, for such a thorough and thoughtful reply!&lt;/P&gt;&lt;P&gt;I have a&amp;nbsp; follow-up question (I'm still new to Survey123 &amp;amp; Power Automate). Which "Content" from the survey do I select for the Parse JSON? Does one of the dynamic texts (photo below) hold all of the survey information that needs to be parsed?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sammy_SalmonNSEA_0-1702495791070.png" style="width: 522px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/88940iF3F82B7C63852B8A/image-dimensions/522x1018?v=v2" width="522" height="1018" role="button" title="Sammy_SalmonNSEA_0-1702495791070.png" alt="Sammy_SalmonNSEA_0-1702495791070.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Sammy_SalmonNSEA_0-1702495791070.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 19:31:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1360535#M53437</guid>
      <dc:creator>Sammy_SalmonNSEA</dc:creator>
      <dc:date>2023-12-13T19:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Repeats in Microsoft Power Automate, Survey123 Connect</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1360538#M53438</link>
      <description>&lt;P&gt;Fair question! Seems I didn't include a screen cap of that step (my apologies).&lt;/P&gt;&lt;P&gt;You want &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;body&lt;/STRONG&gt;&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_0-1702496125595.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/88942iD7838C96C62929C8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_0-1702496125595.png" alt="abureaux_0-1702496125595.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;abureaux_0-1702496125595.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Body, in any step, is essentially the entire raw result/response.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 19:36:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1360538#M53438</guid>
      <dc:creator>abureaux</dc:creator>
      <dc:date>2023-12-13T19:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Repeats in Microsoft Power Automate, Survey123 Connect</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1360640#M53459</link>
      <description>&lt;P&gt;The flow works now! Thank you so much!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 21:40:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-repeats-in-microsoft-power-automate/m-p/1360640#M53459</guid>
      <dc:creator>Sammy_SalmonNSEA</dc:creator>
      <dc:date>2023-12-13T21:40:39Z</dc:date>
    </item>
  </channel>
</rss>

