Hi all
I have a field called Hiring Manager that is shown in an email as Smith, John, I would like to show it as John Smith.
Thanks
KC
Solved! Go to Solution.
Hi, you can use various functions to achieve this.
The functions are:
Example1:
Exp1: substring(triggerBody()['text'],add(2,int(indexOf(triggerBody()['text'],','))),sub(int(length(triggerBody()['text'])),add(2,int(indexOf(triggerBody()['text'],',')))))
Exp2: substring(triggerBody()['text'],0,Sub(int(length(triggerBody()['text'])), sub(int(length(triggerBody()['text'])),int(indexOf(triggerBody()['text'],',')))))
Note the space between the 2.
Example 2 (all-in-one):
concat(concat(substring(triggerBody()['text'],add(2,int(indexOf(triggerBody()['text'],','))),sub(int(length(triggerBody()['text'])),add(2,int(indexOf(triggerBody()['text'],','))))),' '),substring(triggerBody()['text'],0,Sub(int(length(triggerBody()['text'])), sub(int(length(triggerBody()['text'])),int(indexOf(triggerBody()['text'],','))))))
Of course the correct formatting depends on the data being exactly formatted as you've described. Garbage in - garbage out.
Cheers,
Aman
------------------------------------------------------------------------------------------------------
If my post helps you with your problem or answers your question, please mark it Solved or Answered. This helps anyone with similar challenges. If you like my response, please give it a Thumbs Up.
------------------------------------------------------------------------------------------------------
This is the details part from the approval flow, where is says Hiring Manager is a field from SharePoint, I'd like to add an expression to convert the string "Smith, John" to "John Smith". In Excel I would use right, left & find etc - what's the best way to do this in Power Automate.
Thanks
KC
How your organization store data for user? It is in this format- "last name, first name". Can you check display name in Get User Profile" action.
There is way to deal with it. You can manipulate string with split function and then colect first and last name in string variable which you can concat later. Please check display name of get user profile in compose action .
Thanks
Hardesh
Hi, you can use various functions to achieve this.
The functions are:
Example1:
Exp1: substring(triggerBody()['text'],add(2,int(indexOf(triggerBody()['text'],','))),sub(int(length(triggerBody()['text'])),add(2,int(indexOf(triggerBody()['text'],',')))))
Exp2: substring(triggerBody()['text'],0,Sub(int(length(triggerBody()['text'])), sub(int(length(triggerBody()['text'])),int(indexOf(triggerBody()['text'],',')))))
Note the space between the 2.
Example 2 (all-in-one):
concat(concat(substring(triggerBody()['text'],add(2,int(indexOf(triggerBody()['text'],','))),sub(int(length(triggerBody()['text'])),add(2,int(indexOf(triggerBody()['text'],','))))),' '),substring(triggerBody()['text'],0,Sub(int(length(triggerBody()['text'])), sub(int(length(triggerBody()['text'])),int(indexOf(triggerBody()['text'],','))))))
Of course the correct formatting depends on the data being exactly formatted as you've described. Garbage in - garbage out.
Cheers,
Aman
------------------------------------------------------------------------------------------------------
If my post helps you with your problem or answers your question, please mark it Solved or Answered. This helps anyone with similar challenges. If you like my response, please give it a Thumbs Up.
------------------------------------------------------------------------------------------------------
Requesting you pls do not jump in between to any post. If you have any problem in content then you can share your opinion.
It is common practice in community.
Thanks
Hardesh
Glad that worked out for you.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Learn from the top Power BI, Power Apps, Power Automate & Power Virtual Agents experts!
User | Count |
---|---|
32 | |
32 | |
22 | |
22 | |
19 |
User | Count |
---|---|
56 | |
56 | |
41 | |
37 | |
29 |