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

What is the best way to split data from a variable?

Hi everyone, 

 

I am importing data from a sharepoint list into my powerapp. 

 

The column I am importing contains multiple values seperated by commas. 

 

I am trying to split those values by comma and create a list people can check yes/no. 

 

What is the best way for me to split on commas on a variable? 

 

I have attached a screenshot of my powerapp and cirlced the variable I am using in red. 

 

Any help is appreciated. 

 

Thanks, 

 

Keith

6 REPLIES 6
Highlighted
Resolver I
Resolver I

Re: What is the best way to split data from a variable?

You should use split(variable) so the text is splitted.
Next you need a ForAll(splittedtext) and collect it in your columns.

If you need a more advanced example I can create an example for you. Just say it 😉
Highlighted
Regular Visitor

Re: What is the best way to split data from a variable?


@Merlijn wrote:
You should use split(variable) so the text is splitted.
Next you need a ForAll(splittedtext) and collect it in your columns.

If you need a more advanced example I can create an example for you. Just say it 😉

Thanks Merlijn.

 

I tried to split the variable like this: Split(ThisItem.Application, ",") and it errors out saying "Expected text value". 

 

So it seems that the split function will not work

Highlighted
Resolver I
Resolver I

Re: What is the best way to split data from a variable?

Make a new gallery with the following formula in items 

Split(First(DataSourceName1).fieldname, ",")

This will split the first record. Change 'first' for the specified record.

 

 

What do you want to achieve? Are you importing a SP list or are you connected to a list?

Why don't you make a new list (or extend the existing one) with for each column a item?

 

List: Applications

Fields:

User: user@email.com (you can use this as unique identifier)

Application 1: true/false

Application 2: true/false

Application 3: true/false

 

This way it's way easier to edit the records and look up to it than getting a record and splitting it. If you still need to split it; use my formula.

 

How to think:

1. you get a record with multiple values

2. Make a new collection from this record, so the record get splitted:

ClearCollect(SplittedTest;Split(First(DataSource).Field,","))

3. This collection has now made records of your record. You can now use these.

 

 

If any of this helps, or you need help with a new approach to your solution, I can also try to help. 

 

Highlighted
Community Support
Community Support

Re: What is the best way to split data from a variable?

Hi @KeithLowry ,

Based on the issue that you mentioned, I think there is something wrong with your operation. The result the Split() function returned is a Table value, but the Text property of the Label in your Gallery is required to provide a Text value.

 

As an alternative solution, you could consider add a Dropdown control within your Gallery, then set the Items property of the Dropdown box to to following formula:

Split(ThisItem.Title, ", ")

or

Split(ThisItem.Application, ", ")

If there is no extra space between Application 1, Application 2, Application 3 and Application4, please consider modify above formula as below:

Split(ThisItem.Title, ",")

or

Split(ThisItem.Application, ",")

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Regular Visitor

Re: What is the best way to split data from a variable?

Thank you!!!

 

I will try this and see if it works.

 

I appreciate the help!


@Merlijn wrote:

Make a new gallery with the following formula in items 

Split(First(DataSourceName1).fieldname, ",")

This will split the first record. Change 'first' for the specified record.

 

 

What do you want to achieve? Are you importing a SP list or are you connected to a list?

Why don't you make a new list (or extend the existing one) with for each column a item?

 

List: Applications

Fields:

User: user@email.com (you can use this as unique identifier)

Application 1: true/false

Application 2: true/false

Application 3: true/false

 

This way it's way easier to edit the records and look up to it than getting a record and splitting it. If you still need to split it; use my formula.

 

How to think:

1. you get a record with multiple values

2. Make a new collection from this record, so the record get splitted:

ClearCollect(SplittedTest;Split(First(DataSource).Field,","))

3. This collection has now made records of your record. You can now use these.

 

 

If any of this helps, or you need help with a new approach to your solution, I can also try to help. 

 


 

Highlighted
Community Support
Community Support

Re: What is the best way to split data from a variable?

Hi @KeithLowry ,

Have you taken a try with the solution I provided above?

Is the solution helpful in your scenario?

 

Based on the needs that you mentioned, I think the solution I provided above could achieve your needs. Please consider take a try with it, then check if the issue is solved.

 

If you have solved your problem, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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