cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tthompsonesri
Level: Powered On

Build and Replace Array

Hi Powerusers,

 

I'm making two HTTP Requests to get JSON from two different services, I then parse out the JSON into thier own variables in dynamic content.

 

One request contains an array of valid ID's, with the following format: 

 

{"objectIdFieldName":"objectid","objectIds":[1,2,4,5,6]}

The second request contains an array, named 'order', which has id's that are old and invalid. It has the following format:

 

{"_ssl":null,"source":"91d75e9b375e4e9b9b3a4004544bfadf","values":{"order":[{"id":1,"visible":true},{"id":2,"visible":true},{"id":3,"visible":true},{"id":4,"visible":true},{"id":5,"visible":true},{"id":6,"visible":true},{"id":7,"visible":true},{"id":8,"visible":true}],"title":"Missing Children Cases Map Tour","colors":"#444;#B4B4B4;#E5E5E5","layout":"side-panel","social":{"bitly":false,"twitter":false,"facebook":false},"webmap":"989ddcd5ac6a4155b18f96875d05108d","logoURL":null,"template":"Map Tour","zoomLevel":"12","logoTarget":null,"sourceLayer":"service_df9e032e61cf4e6cbaa4da750930c723_478","headerLinkURL":"https://storymaps.arcgis.com","fieldsOverride":{"fieldID":"objectid","fieldURL":"pic_url","fieldName":"name","fieldThumb":"thumb_url","fieldIconColor":"objectid","fieldDescription":"description"},"headerLinkText":"A Story Map","locationButton":true,"placardPosition":null,"templateVersion":"2.12.1","templateCreation":"2.12.1"},"folderId":"86a73fd80e38466c92d52f3fd81c09c2"}

 

Each "id" property in the second requests order array may be invalid, and must be replaced with all results from the first request objectids array. 

 

Essentially what I need to do is build a new array with only the id's found in the first requests objectids array and replace the "order" array in the second request with that newly built one. This new array has to contain both properties of id and visible (visible will always be true). 

 

I've approached this in integromat by looping through the first objectIDs array, adding the id and visible property each time to that new array, I then post that new array to the service, overwriting the invalid list of ids.

 

Is this possible in Flow? I'm caught up a bit on how to loop through each ID in the first request and build a new array.

 

 

Thanks in advance for your help,

 

 

Tom

1 ACCEPTED SOLUTION

Accepted Solutions
tthompsonesri
Level: Powered On

Re: Build and Replace Array

I was able to solve this last week while my post was marked as spam. It was actually easier than I expected, at the time of this post I did not know we were able to create new arrays.

 

I first initialized a new array:

 

Array.PNG

 

I then looped through the ObjectID Array, and with each iteration of the loop I appended that value as the Current Item to the array.

 

LoopArray.PNG

 

Lastly, I passed that completed, new array into an HTTP POST request, overwriting the invalid array with the valid array.

 

Passing.PNG

 

 

 

This workflow replaced the Inteogromat workflow I had been using, very happy with it.

 

 

Tom

 

2 REPLIES 2
Community Support Team
Community Support Team

Re: Build and Replace Array

Hi @tthompsonesri,

 

You could take a try to achieve your needs with microsoft flow even though maybe it is difficult.

 

Best regards,

Alice

tthompsonesri
Level: Powered On

Re: Build and Replace Array

I was able to solve this last week while my post was marked as spam. It was actually easier than I expected, at the time of this post I did not know we were able to create new arrays.

 

I first initialized a new array:

 

Array.PNG

 

I then looped through the ObjectID Array, and with each iteration of the loop I appended that value as the Current Item to the array.

 

LoopArray.PNG

 

Lastly, I passed that completed, new array into an HTTP POST request, overwriting the invalid array with the valid array.

 

Passing.PNG

 

 

 

This workflow replaced the Inteogromat workflow I had been using, very happy with it.

 

 

Tom

 

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 47 members 4,922 guests
Please welcome our newest community members: