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

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.

 

2019-08-27_8-53-59.pngFLOW history2019-08-27_8-55-39.pngFLOW setup

8 REPLIES 8
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

rmc
Level: Powered On

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

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

Community Support Team
Community Support Team

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
rmc
Level: Powered On

Re: Looping through array to create SP list items

@RezaDorrani 

 

Not understanding what should in the Compose step?

Thanks

rmc
Level: Powered On

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

 

Community Support Team
Community Support Team

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.

rmc
Level: Powered On

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,976)