Fore any one interetsed, I looked everywhere to help me with formulas to fix complex surnames like McCarthy, McDonald, O'Brian, Smith-Jones or Smith Jones to show upper and lower correctly. In excel or similar it can be done in one formula, but in flow it became an intersting past time.
The net result was the below:
1. I extract the surname from the trigger and run the following condition. Note I coverted all text to Uppercase to ensure case matching so toUpper(triggerbody()?[Surname'])
2. The created 7 Compose Actions based on yes:
Compose1: gets length of Surname - length(triggerBody()?['Surname'])
Compose2: detemines the position of the Surname where changs is to be made:
Hi @leyburn19 ,
I have made a simple flow using the function you provided, it seems that nothing difference happens between the original name and the formatted name.
Such as McCarthy still be McCarthy after formatted, O’Brain stil be O’Brain after formatted.
Could you show me more details on how do you want to format the SurName?
It is for checking and fixing, Say O'Brian was o'brian or MacDonald was macdonald. This fixes the Case to be proper. If it is already correct it comes out with no changes. users often do not do it properly
Hi @leyburn19 ,
I suppose that you need to add a Condition to check if the first letter in the word is capital or not.
If yes, do the previous action. If no, do corresponding actions.
The function used in the Condition is:
first(toUpper(triggerBody()['text'])) is equal to first(triggerBody()['text'])