web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Combine two arrays/add...
Power Automate
Answered

Combine two arrays/add a field to an Object

(0) ShareShare
ReportReport
Posted on by 15

I am trying to take the array of an ADO query and trying to add a field to it.

 

The main array looks something like:

{

     "System.Id": 38473

     "System.AssignedTo": Nick

},

{

     "System.Id": 45636

     "System.AssignedTo": James

},

{

     "System.Id": 29596

     "System.AssignedTo": Katie

},

and keeps going...

 

and I am trying to add:

{

     "Description": "test desc."

},

{

     "Description": "Plain text test"

},

{

     "Description": "Random Desc."

},

and so on...

 

I need it to look like this:

{

     "System.Id": 38473

     "System.AssignedTo": Nick

     "Description": "test desc."

},

{

     "System.Id": 45636

     "System.AssignedTo": James

     "Description": "Plain text desc."

},

And so on.

 

I have tried to use append only but that did not give me the desired outcome. I have tried union and that didn't do what I was looking for either. Everything is in order, I just need it to be added to the main array.

Categories:
I have the same question (0)
  • Verified answer
    Matthy79 Profile Picture
    4,180 Super User 2024 Season 1 on at

    Hello @Jake17 

     

    Just out of curiosity. How do you get the second array, why doesn't it have any information to connect them and why is everything in order?

     

    A select action should do the work for you.

     

    From: range(0, length(YourMainArray))

    Map: addProperty(YourMainArray[item()], 'Description', YourDescriptionArray[item()]['Description'])

  • Jake17 Profile Picture
    15 on at

    Hi @Matthy79 

     

    So here is the backstory:

     

    The first array actually has a description field, but it is covered in HTML and unreadable. 

    The second array is derived from the first. I used HTML to text action to convert the description field and then put that converted description field into another array. That is why it is also in order.

     

    I now need to put the new converted descriptions into the old array, but have been unsuccessful. 

  • Matthy79 Profile Picture
    4,180 Super User 2024 Season 1 on at

    Didn't the select action work? Please post your current flow.

  • Jake17 Profile Picture
    15 on at

    Everything I've tried past the select action has not worked. If I do a union or append (at least the way I've been doing it), it does not have the desired results. I have posted what happens with a union. It just adds the description to the end of it rather than it being:

    {

         "ID": "39438"

         "Description": "Random words for example"

    }

    {

         "ID": "94788"

         "Description": "This is a description"

    }

  • Matthy79 Profile Picture
    4,180 Super User 2024 Season 1 on at

    On the screenshots I can’t see the solution I provided. Please try the select action as suggested.

  • Jake17 Profile Picture
    15 on at

    I'm not sure if I did it right, but this is what I got and it is not what I was looking for 

  • Jake17 Profile Picture
    15 on at

    My end goal is to use the combined array to make an html table, so I need to be able to call each field individually. Can I do that with the way it is currently configured?

  • Matthy79 Profile Picture
    4,180 Super User 2024 Season 1 on at

    Please check the map. You have to switch to text mode and only add the formula there (not key value).

  • Matthy79 Profile Picture
    4,180 Super User 2024 Season 1 on at

    In generell I would suggest to get rid of the loop. If your html is standardized you could just use one select action to do everything. If not, you should at least remove the variable and speed up the loop by using concurrency control. In that way you would only have to change the formula in the select action to use the html to text array instead of your variable.

  • v-jefferni Profile Picture
    on at

    Hi @Jake17 ,

     

    The solution from @Matthy79 is great and absolutely correct. I created a Select operator using this solution and help you understand it.

    vjefferni_0-1703498746747.png

    result:

    vjefferni_1-1703498773622.png

     

    Best regards,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard