cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Collection from PA, via Flow, to SP list

This is a continuation of this question: link

 

I want to get a Powerapps collection into a Sharepoint list, if my flow request is approved, so I need data to go through flow and depend on the approval from a manager before entering the Sharepoint list.

 

I have a collection in PowerApps:

collection.PNG

I pass this to a flow, where I "concat" the collection into a string as suggested

 

Concat(Bestilling; Pris & "," & Pris & "," & "," & Str" & "#")

grab the information in my flow:

forbehandling.PNG

 

I then want to get this information into sharepoint: ("brødtekst" is body in english I believe) with an apply to each, and "Create Item" in Sharepoint.

apply to each.PNG

so it ends up like this (manually entered):

sp.PNG

and not like this:

forkert.PNG

 

How do I treat the concatenated string (concat) in flow, so that I in "Apply to each" can populate my list?

Or should I use another approach.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Collection from PA, via Flow, to SP list

Hi @ AndreasRas,

 

I have made test on my side, I have create a sharepoint list as below:  5.png The configuration of my collection in the PowerApps as below:

6.png

For the purpose of this demo I have some controls on in my app. a Text input Pris, a Text input Produkt, a Text input Str, a Add button to Collect the shop,a Submit button to send it all to flow, a Clear button and a gallery to see the shop taken
To grab an shop I have the following formula on the OnSelect property of the Add button: Collect(shop, {Pris:Pris.Text, Produkt:Produkt.Text, Str:Str.Text})
This stores each shop in a collection named shop

The gallery control’s “Items” property it bound to the shop collection.

The “OnSelect” property of the Submit button contains the following formula:

Clear(SubmitData); ForAll(shop,Collect(SubmitData, { Pris: Pris, Produkt:Produkt, Str:Str })); PowerApps.Run(Concat(SubmitData, Pris & "#" & Produkt & "*" & Str & "|"))

The formula creates random shop data to a collection named SubmitData. Then the shop data is concatenated using “#”,”*”,”|” between each Pris, Produkt,and Str. This is then passed into the PowerApps flow I have added to the PowerApp.   The data being passed to the flow would looks like this: Pris1#Produkt1*Str1|Pris2#Produkt2*Str2|, we use the “#”,”*”,”|” to separate each Pris, Produkt,and Str from each other.

 

We could click the “Flow” is the PowerApp as below to create a flow on the collection:

 7.png

We could refer to steps below to create a flow as below:

  1. The trigger “PowerApps” would be automated created in the above steps.
  2. Add action “Create item” of sharepoint connector, choose the Site Address and List Name, choose the “Ask in PowerApps” dynamic content in the “Title” field. Then you could see the “'Createitem_Title” dynamic content of the trigger.
  3. Add action Compose under the trigger, the expressions of the Compose as below:

      split(triggerBody()['Createitem_Title'],'|')

     4.Add a Filter array under the Compose, choose the Output dynamic content of the Compose in the From field, click “Edit in advanced mode” and use the following formula to remove empty values. 

@not(equals(item(), ''))

      5.Add an Apply to each under the Filter array, choose the Body dynamic content in the input field.

      6.Add action Compose 2 inside the Apply to each, the expressions of the Compose 2 as below:

split(items('Apply_to_each'),'#')[0]

      7.Add action Compose 3 under the Compose 2, the expressions of the Compose 3 as below:

split(split(items('Apply_to_each'),'#')[1],'*')[0]

      8.Add action Compose 4 under the Compose 3, the expressions of the Compose 4 as below:

split(items('Apply_to_each'),'*')[1]

      9.Remove the  action “Create item” under the Compose 4, change the Title field with the “Output” dynamic content of the “Compose 2”,choose the “Output” dynamic content of the “Compose 3” in the “Produkt” field, choose the “Output” dynamic content of the “Compose 4” in the “Str” field.

 8.png

When click the Submit button to run the App, the flow would run successfully as below:

 9.png

The items would be created in the sharepoint list as below:

 10.png

 

 

 

Regards,
Alice Zhang

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: Collection from PA, via Flow, to SP list

Hi @ AndreasRas,

 

I have made test on my side, I have create a sharepoint list as below:  5.png The configuration of my collection in the PowerApps as below:

6.png

For the purpose of this demo I have some controls on in my app. a Text input Pris, a Text input Produkt, a Text input Str, a Add button to Collect the shop,a Submit button to send it all to flow, a Clear button and a gallery to see the shop taken
To grab an shop I have the following formula on the OnSelect property of the Add button: Collect(shop, {Pris:Pris.Text, Produkt:Produkt.Text, Str:Str.Text})
This stores each shop in a collection named shop

The gallery control’s “Items” property it bound to the shop collection.

The “OnSelect” property of the Submit button contains the following formula:

Clear(SubmitData); ForAll(shop,Collect(SubmitData, { Pris: Pris, Produkt:Produkt, Str:Str })); PowerApps.Run(Concat(SubmitData, Pris & "#" & Produkt & "*" & Str & "|"))

The formula creates random shop data to a collection named SubmitData. Then the shop data is concatenated using “#”,”*”,”|” between each Pris, Produkt,and Str. This is then passed into the PowerApps flow I have added to the PowerApp.   The data being passed to the flow would looks like this: Pris1#Produkt1*Str1|Pris2#Produkt2*Str2|, we use the “#”,”*”,”|” to separate each Pris, Produkt,and Str from each other.

 

We could click the “Flow” is the PowerApp as below to create a flow on the collection:

 7.png

We could refer to steps below to create a flow as below:

  1. The trigger “PowerApps” would be automated created in the above steps.
  2. Add action “Create item” of sharepoint connector, choose the Site Address and List Name, choose the “Ask in PowerApps” dynamic content in the “Title” field. Then you could see the “'Createitem_Title” dynamic content of the trigger.
  3. Add action Compose under the trigger, the expressions of the Compose as below:

      split(triggerBody()['Createitem_Title'],'|')

     4.Add a Filter array under the Compose, choose the Output dynamic content of the Compose in the From field, click “Edit in advanced mode” and use the following formula to remove empty values. 

@not(equals(item(), ''))

      5.Add an Apply to each under the Filter array, choose the Body dynamic content in the input field.

      6.Add action Compose 2 inside the Apply to each, the expressions of the Compose 2 as below:

split(items('Apply_to_each'),'#')[0]

      7.Add action Compose 3 under the Compose 2, the expressions of the Compose 3 as below:

split(split(items('Apply_to_each'),'#')[1],'*')[0]

      8.Add action Compose 4 under the Compose 3, the expressions of the Compose 4 as below:

split(items('Apply_to_each'),'*')[1]

      9.Remove the  action “Create item” under the Compose 4, change the Title field with the “Output” dynamic content of the “Compose 2”,choose the “Output” dynamic content of the “Compose 3” in the “Produkt” field, choose the “Output” dynamic content of the “Compose 4” in the “Str” field.

 8.png

When click the Submit button to run the App, the flow would run successfully as below:

 9.png

The items would be created in the sharepoint list as below:

 10.png

 

 

 

Regards,
Alice Zhang

View solution in original post

Anonymous
Not applicable

Re: Collection from PA, via Flow, to SP list

Jolly good 🙂

Dawidvh
Level 10

Re: Collection from PA, via Flow, to SP list

Hi everyone,

 

Good news, with the new JSON in function in PowerApps this is a lot simpler as we no longer have to work with concatenated strings.

 

Please see below video to see how to use it:

https://youtu.be/HLdOO4JPZ2I

 

Dawid van Heerden
Follow on Twitter: @davestechtips
Subscribe to YouTube: https://www.youtube.com/davestechtips?sub_confirmation=1
**If you found this reply helpful, please mark this as the answer to close the topic and make it easier to find for other people with similar questions.

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!

Users Online
Currently online: 162 members 5,263 guests
Please welcome our newest community members: