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.

 

FLOW historyFLOW historyFLOW setupFLOW setup

8 REPLIES 8
RezaDorrani
Dual Super User II
Dual Super User II

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

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

RezaDorrani
Dual Super User II
Dual Super User II

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

v-litu-msft
Community Support
Community Support

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

@RezaDorrani 

 

Not understanding what should in the Compose step?

Thanks

rmc
Frequent Visitor

@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

 

v-litu-msft
Community Support
Community Support

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

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

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Kudoed Authors
Users online (3,316)