cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KeithLowry
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
Merlijn
Resolver I
Resolver I

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 😉


@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

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. 

 

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.

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. 

 


 

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (56,844)