cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

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 III
Dual Super User III

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 III
Dual Super User III

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

Highlighted
Frequent Visitor

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

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,046)