cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Smarty_
Helper II
Helper II

How can I add columns to a two-dimensional array (collection / table)?

My case: 

I have a two-dimensional array where the number of columns is given by a variable, thus I need to add columns to my array in the loop.

Smarty__0-1635319285662.png

Smarty__1-1635319296324.png

Smarty__2-1635319323623.png

 

- MaxAmmountOfPredecessers is supposed to be a variable (I haven't fixed it yet). 

- PredecessorsEE - my array

So far it looks something like this:

ID0
4320
5420
8780

 

I need to convert it:

ID0123...

N

(supposed to be MaxAmmountOfPredecessers)

4320000 0
5420000 0
8780000 0

 

I tried to use addProperty function, however it works only with objects. If I decomposing the array into objects in the loop, I need somehow to collect the results of each iteration of the loop.

 

Could you help me please?

1 REPLY 1
tom_riha
Super User
Super User

Hello @Smarty_ ,

after using addProperty(...) you must store the updated object somewhere, e.g. a variable. Initialize an object variable, inside the inner 'Apply to each' use the 'Compose' to addProperty(...) to that variable, and then 'Set variable' to the output of the 'Compose'. 

At the end of the inner loop append the object variable to the array variable, clear the object variable, and start building the new object.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (3,371)