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
Brentless
Kudo Kingpin
Kudo Kingpin

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.
 
 
 

@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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,538)