cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rmc
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.

 

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

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.

rmc
Frequent Visitor

Re: Looping through array to create SP list items

@RezaDorrani 

 

Not understanding what should in the Compose step?

Thanks

rmc
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

 

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.

rmc
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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (6,983)