I have user display names in this format:
Last, First M DEPT REGION COUNTRY
// Smith, Bob R ACCOUNTING WEST USA
I want to show the name in this format:
Last, First
// Smith, Bob
Here's my current expression (which is close, but it includes the middle initial):
first(split(item()?['Employee/DisplayName'],'DEPT'))
// Smith, Bob R
I'd like to get rid of everything after the first name, including the middle initial. I've tried indexOf() and substring(), but haven't been able to find the right combination.
Solved! Go to Solution.
Hi @Siddz
// Smith, Bob R
You could do a split with spaces and specify the index. Try the below.
split('Smith, Bob R',' ')[0]
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogHi @Siddz
// Smith, Bob R
You could do a split with spaces and specify the index. Try the below.
split('Smith, Bob R',' ')[0]
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogThanks, @abm!
Here's my final expression :
concat(split(item()?['Employee/DisplayName'],' ')[0], ' ', split(item()?['Employee/DisplayName'],' ')[1])
// Result: Smith, Bob
I added concat() to join the last name with the first name (with a space between the names).
User | Count |
---|---|
95 | |
45 | |
21 | |
18 | |
18 |
User | Count |
---|---|
142 | |
50 | |
43 | |
40 | |
31 |