cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jimbo1 Advocate I
Advocate I

Manipulating strings to remove common errors

**** Sorry should have posted to Flow board *****

Hi,

 

I have an input that collects information entered by employees, however there are some common re-occurring errors that keep occurring that despite repeated instructions don’t seem to sink in. So in order to save time at a later date I though I would try and make the changes in flow. The main ones are:

 

1. Adding salutations to names for example Mr Smith being entered. I would prefer to just have the surname and loose the salutation, it makes sorting alphabetically a lot easier.

2. The second is with UK postcodes and not entering a space between the two sections I.e AA12BB or AA123BB.( not that they are of variant lengths but always have a space before the last three characters.

 

Also if there was a way to properly capitalise the strings that would help with my OCD lol, i.e Proper case for example 1 and all upper for the 2nd.

 

I have been able to add these strings as they currently are as variables before adding to a sharepoint list. I presume I need to use a compose action with the relevant expressions but cannot seem to get it to work.

 

Any assistance would be greatly appreciated.

 

 

2 REPLIES 2
Highlighted
Brentless Kudo Kingpin
Kudo Kingpin

Re: Manipulating strings to remove common errors

I'd probably do a few Replaces to eliminate the Mr. and Mrs, though you'll need to account for the different variations (such as Mr. versus Mr no period)

 

replace(YOURFIELD,'Mr','')
 
You can cascade this like replace(replace(YOURFIELD,'Mr',''),'Mrs','') and so on
 
You can use length(MYFIELD) to get the length of the variable length strings
 
Then do a calculation to get length minus 3, then use substring()
 
First part would look like: substring(MYFIELD,0,LENGTH-3)
Second part would look like substring(MYFIELD,LENGTH-3,LENGTH)
Then you can add them together in a variable or compose with the space.
I'd probably start by removing all spaces in the fiend before doing that algorithm, to account for whether they did actually add the space.
 
toUpper() will convert everything to upper case
Not sure what would conver to Proper case off the top of my head, but you could do some more substrings, combined with a toUpper on the first character.
 
 
 
Jimbo1 Advocate I
Advocate I

Re: Manipulating strings to remove common errors

@BrentlessThanks for your help so far, do you know how to remove all spaces from the string, I've tried " replace(string," ","") but just says invalid expression.

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,140)