Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Manipulating strings to remove common errors

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



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.



Level 8

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)


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.
Level: Powered On

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


Power Automate Community User Group Member Badge

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


Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!


Microsoft Learn

Learn how to build the business apps that you need.


Power Platform World Tour

Find out where you can attend!


Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Users Online
Currently online: 196 members 5,421 guests
Please welcome our newest community members: