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

Generate a collection from CSV format data sent from flow - string format is below - needs a formula for splitting them

String format:

streetNumber,streetName,Suburb,Postcode,State,xxxxx,xxxxx,xxxxx,xxxxx,xxxxx,xxxxx,xxxxx,xxxxx,xxxxx,xxxxx,xxxxx,xxxxx,xxxxx,xxxxx,xxxxx

 

The above string is the format parsed from Flow to Powerapps. I want to be able to turn it into a collection.

 

The first five comma separated values would be the title. The rest of the comma separted values would be sequentially matched to each title which is represented by 'xxxxx' in the string. In the above string, there are 15 'xxxxx' which indicates that there are three addresses returned from Flow to Powerapps.

 

I want to be able to split them so that I can show them in a collection with 5 heading at the beginning of the string.

 

Thanks for the help 🙂

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: Generate a collection from CSV format data sent from flow - string format is below - needs a formula for splitting them

Hi @IAmTheAppUser 

 

If you have license to use Premium connectors, then you can directly use the Response action to send JSON to PowerApps. This can be collected in a collection using ClearCollect(CollectionName,FowName.Run())
Once you make any changes to the flow, you need to remove it and register it again to the canvas app.
 
If you do not have license for premium connectors then you can use below expressions:
Clear(MyCollection);With({Loops:(CountRows(Split(Label1.Text,","))/5)-1},ForAll(FirstN([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],Loops),Collect(MyCollection,{streetNumber:Last(FirstN(Split(Label1.Text,","),Value+5)).Result,streetName:Last(FirstN(Split(Label1.Text,","),Value+6)).Result,Suburb:Last(FirstN(Split(Label1.Text,","),Value+7)).Result,Postcode:Last(FirstN(Split(Label1.Text,","),Value+8)).Result,State:Last(FirstN(Split(Label1.Text,","),Value+9)).Result}))) 
 
Note: We cannot pass variable the keys for name of columns in collections, hence this needs to be harcoded. Here, you need to replace Label1.Text with the value that holds this returned string.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

2 REPLIES 2
Highlighted
Dual Super User
Dual Super User

Re: Generate a collection from CSV format data sent from flow - string format is below - needs a formula for splitting them

Hi @IAmTheAppUser 

 

If you have license to use Premium connectors, then you can directly use the Response action to send JSON to PowerApps. This can be collected in a collection using ClearCollect(CollectionName,FowName.Run())
Once you make any changes to the flow, you need to remove it and register it again to the canvas app.
 
If you do not have license for premium connectors then you can use below expressions:
Clear(MyCollection);With({Loops:(CountRows(Split(Label1.Text,","))/5)-1},ForAll(FirstN([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],Loops),Collect(MyCollection,{streetNumber:Last(FirstN(Split(Label1.Text,","),Value+5)).Result,streetName:Last(FirstN(Split(Label1.Text,","),Value+6)).Result,Suburb:Last(FirstN(Split(Label1.Text,","),Value+7)).Result,Postcode:Last(FirstN(Split(Label1.Text,","),Value+8)).Result,State:Last(FirstN(Split(Label1.Text,","),Value+9)).Result}))) 
 
Note: We cannot pass variable the keys for name of columns in collections, hence this needs to be harcoded. Here, you need to replace Label1.Text with the value that holds this returned string.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

IAmTheAppUser
Level: Powered On

Re: Generate a collection from CSV format data sent from flow - string format is below - needs a formula for splitting them

Hi Yashag2255

 

The functionality of my app gets the files name in one drive. Then the user selects the file name in the app. The app then triggers the flow to get the file content.

 

Is there any way in Flow to parse the data in the user selected file into Json? If there is one, I could just parse the data from the file as Json, else, I would have to trigger a Azure function in flow that sorts the format of the data.

 

Thanks for help 🙂

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (3,882)