locked
[SOLVED] For Each Loop and Array RRS feed

  • Question

  • Hi,

    I'm pretty new to Logic Apps so all help is much appreciated! I'm trying to create a simple workflow where I have a HTTP call that returns data as below. I'd like to loop each "ID" to another HTTP call for further processing.

    I'm having challenges getting the for each loop to work. It seems to pick up the whole object instead of the array.

    {  
     "odata.metadata": "www.com",  
     "value": [    
       {      
         "ID": 5562,      
         "RowIdent": "addfbe80-ebbb-4b7c-95d6-136aae7279d3"
       },    
       {      
         "ID": 5593,  
         "RowIdent": "ce8f9028-9207-428b-bfc5-cf42be5f0215" 
       }  
      ]
    }

    Thanks,

    Ant



    • Edited by AOT1000 Monday, January 13, 2020 3:51 PM SOLVED
    Wednesday, January 8, 2020 12:35 PM

Answers

  • Got it solved. It was actually rather simple. It didn't need any coding, just using standard actions. I'm not sure how I missed these in the beginning but it works now exactly as needed. Thanks for the help guys!

    Cheers,

    Ant

    Monday, January 13, 2020 3:50 PM

All replies

  • Try something like this in your for each input:

    @body('Name of HTTP shape')['value']

    Morten la Cour

    Wednesday, January 8, 2020 8:51 PM
  • Hi AOT1000 Any updates on this?
    Saturday, January 11, 2020 4:06 AM
  • I actually got the looping to work with rather simple steps.

    I only had to do a Parse JSON action before the loop and pass that to the for each loop.

    However, I'm still facing an issue as it loops each of full object. I'd only need the 5593. 

    {      
         "ID": 5593,  
         "RowIdent": "ce8f9028-9207-428b-bfc5-cf42be5f0215" 
    }  

    Input to the call is like this:

    https://URL/{"ID":5593,"RowIdent":"ce8f9028-9207-428b-bfc5-cf42be5f0215"}

    How could I parse the 5593 out and use that in the for each loop action instead of the whole object?

    Monday, January 13, 2020 3:31 PM
  • Got it solved. It was actually rather simple. It didn't need any coding, just using standard actions. I'm not sure how I missed these in the beginning but it works now exactly as needed. Thanks for the help guys!

    Cheers,

    Ant

    Monday, January 13, 2020 3:50 PM