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

Highlighted

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

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

Highlighted

@RezaDorrani 

 

Not understanding what should in the Compose step?

Thanks

Highlighted
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

 

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

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

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (7,520)