cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Looping through array to create SP list items

Created an array of ~10 people with 6 columns in each row. I am trying to loop through the array and create a list item in SharePoint for each row.

 

The issue is being able to reference the respective column (index) in the array to match up with the list item column respectively.

 

Screenshots below of what I have.

 

Any guidance would be much appreciated.

 

FLOW historyFLOW historyFLOW setupFLOW setup

8 REPLIES 8
Highlighted
Dual Super User
Dual Super User

Re: Looping through array to create SP list items

Hi @rmc 

 

run a for loop of your array (compose action)

 

then inside for loop just use expression item()

 

this will give you each item value in the loop

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Highlighted
Frequent Visitor

Re: Looping through array to create SP list items

Thanks for quick response Reza, however using the expession item () just returns NULL.

 

Per screenhsot I am trying to get values  and post values as follows:

 

BUNO - populate with eachDataRow[5] = "990004"

EmpName -  populate with eachDataRow[1]<space>eachDataRow[2] = "Jonathon Doe"

EmpFileNo - populate with eachDataRow[0] = "100000"

2019-08-27_11-05-43.png

2019-08-27_10-56-56.png

Highlighted
Dual Super User
Dual Super User

Re: Looping through array to create SP list items

Hi @rmc 

 

Misunderstood your scenario

 

do not do a for loop

 

directly after compose action - do create item

 

and use expressions

outputs('eachDataRow')?[0]
outputs('eachDataRow')?[1]
outputs('eachDataRow')?[2]
 
to fetch values from your array
 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Highlighted
Community Support
Community Support

Re: Looping through array to create SP list items

Hi @rmc,

Cause you have an array of ~10 people with 6 columns, so you could initialize your Data array like the following:

Annotation 2019-08-28 142003.png

 

In the Apply to each input bar, you should input the whole array into it.

Then append these columns use the item()?['number'], item()?['name'], etc.

Annotation 2019-08-28 142026.png

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
Frequent Visitor

Re: Looping through array to create SP list items

@RezaDorrani 

 

Not understanding what should in the Compose step?

Thanks

Frequent Visitor

Re: Looping through array to create SP list items

@v-litu-msft 

 

I follow that, but struggling how you set the 'title' for each array index. I am reading a 1,000 line CSV file with the GetCSV function.

 

Thanks

 

Highlighted
Community Support
Community Support

Re: Looping through array to create SP list items

Hi @rmc,

 

Maybe you are using the Parse CSV action of plumsail, if not, you can refer to this document #parse-csv.

After you parse CSV file, you can use the Apply to each action to set the "title" for each array index by putting the body of parse CSV.

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
Frequent Visitor

Re: Looping through array to create SP list items

Hi @v-litu-msft ,

 

No. Not using the Plumsail Parse CSV. Am using the native Get File Content action see below.

2019-09-03_12-38-45.png

Thanks

 

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,333)