cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Erase second surname using PA

Hey!

 

I'm trying to build the following flow:

 

Input: WORKS

JSON: WORKS

  • NAME: frontname Surname - Surname
  • ADRESS: adress
  • ETC.

Output NAME: Frontname Surname: DOESN'T WORK, HELP!

ADRESS: WORKS

i.e.

NAME: Katniss Mellark - Everdeen --> Kattnis Mellark

Adress: District 12

NAME: Peeta Mellark --> Peeta Mellark

Adress: District 12

So I'd like the second surname to disappear. 

 

Can anyone help me out on how to do this please? I think I have to use if/else functions... but I don't know for sure...

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
tom_riha
Super User
Super User

Hello @Anonymous ,

if the second name is always after a - you can use the split(...) expression, split the string by the - and take only the first part, e.g.

split('Katniss Mellark - Everdeen', '-')[0]

and combine it with the trim(...) to remove the potential empty spaces

trim(split('Katniss Mellark - Everdeen', '-')[0])


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

1 REPLY 1
tom_riha
Super User
Super User

Hello @Anonymous ,

if the second name is always after a - you can use the split(...) expression, split the string by the - and take only the first part, e.g.

split('Katniss Mellark - Everdeen', '-')[0]

and combine it with the trim(...) to remove the potential empty spaces

trim(split('Katniss Mellark - Everdeen', '-')[0])


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (5,113)