Is this possible to achieve in powerapps?
TextInput1 = This is my æwesome team!
Label = TextInput1 without special characters and spaces (Thisismywesometeam)
I've created a sharepoint list for requesting new teams in our org.
I've customised the form and added an approval flow that creates the group and adds a team to the group (using graph).
In order to create the group I have to supply "mailNickname" without spaces and special characters.
This is a manual field in the form today. I've added checks using regex that warns them if it containts spaces or special characters, I've also added a "save" button that is disabled if this warning is visible.
I'd like to autofill this field based on the team name they provide. I've tried googling around, but can't find a solution. Any ideas?
Solved! Go to Solution.
The first thing that came to my mind is this:
Label.Text= Replace(Replace(Replace(TextInput.Text," ",""),"<<SpecialCharacter1>>",""),"<<SpecialCharacter2>>","")
I don't know if it is good enough for you.
I looked into Replace and substitute, but was hoping for a more elegant solution .
To check the field and warn if it's not filled correctly i just use:
Hi @bottekott ,
Could you please share a bit more about your scenario?
Do you want to remove special characters and spaces from the Text value within the Text Input1 box?
I assume that you have known the special characters within the Text Input1 box, and you want to remove special characters and spaces from the Text value within the Text Input1 box. Based on the needs that you mentioned, I think the Substitute() function could achieve your needs.
I have made a test on my side, please take a try with the following workaround:
Set the Text property of the Label to following:
Substitute(TextInput1.Text, " ", Blank()), /* <-- Remove spaces */
On your side, you should type (nested Substitute() function):
Substitute( Substitute(TextInput1.Text, " ", Blank()), /* <-- Remove spaces */ "<Special Character>",Blank() )
More details about Substitute() function in PowerApps, please check the following article:
Currently, within PowerApps, there is no way to detect if there is a special character existed within a Text String. If you want to detect if there are some special characters existed within a Text string, I afraid that there is no way to achieve your needs currently.
Hi @bottekott ,
Just an update -- Based on the needs that you mentioned, I think the IsMatch() function could achieve your needs.
If you just want to check if a Text String matches a specific format, I think IsMatch function is a good choice for you.
Thanks for the input, I'll share some screenshots and more details about what I'm hoping to achieve .
This is how the form works today:
How I would like it to be:
I see now how I could do it with a long nestet replace or subsitute, but it does not seem very elegant. It would be better to solve it with a "catch-all" regex like in the ismatch formula.
But if thats't the way to solve it, I guess I just have to deal with it .
Hi @bottekott ,
I have made a test on my side, please take a try with the following workaorund:
Set the Default property of the Text Input box within the Teamnavn kort Data card to following:
Filter(Split(DataCardValue2.Text,""), IsMatch(Result, "[a-zA-Z0-9]*")), /* <-- DataCardValue2 represents the Text Input box within the Visningsnavn Data card */
Set the DisplayMode property of the Text Input box within the Teamnavn kort Data card to following: