Remove specific characters from values in PowerApps
Have you ever had the scenario where, you had values in SharePoint (or Dataverse) with a character, or the end of the value is not relevant for your app, and it should not be displayed? I did.
In this first PowerPlatform blog post, we’ll get rid of the end of the value that’s after a specific character. And we’ll also include getting rid of the character since it won’t be relevant nor nice to see anymore!
Setting up the scene
Let’s start by creating a SharePoint list, and a single line of text column in SharePoint. I’ll call it
Ref Number. We’ll then create a couple of items for testing purposes.
For simplicity, we’re also going to use the
Title column which is already present in the list.
From a PowerApps perspective, let’s connect our SharePoint list as a datasource, and just add a gallery to a screen, then configure the fields to be our
As we only have 2 fields for this demo, we’ll choose the gallery layout to be only Title and subtitle.
Now that we’re displaying the data we want in the gallery, if we look at the formula in the
Text property of the
Ref Number, we’ve got
ThisItem.'Ref Number'. And we see the entire number as it is present in SharePoint.
We need to change the formula so we don’t get to see the
/1 from the items. So we could trim everything after the
/ character, including the character itself?
BUT WAIT… Have you noticed that the other ones also contain a
/ character? 😱
This means, we need a condition to exclude the items which have
Let’s do it!
Ref Number field in the gallery, and navigate to the
Text property. Insert the following formula:
'Ref Number'to your own column name.
And observe the results! 🥳
We’ve removed the
/1 from the items and kept the
Thanks for reading!