cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
djox
Regular Visitor

Replace space in variable with period

I am calling a flow from Power Virtual Agents, I am passing the user name that contains spaces e.g. Fred A Smith and I want to replace the spaces with a period i.e. Fred.A.Smith to use in a API call 

 

I initialized a variable USER_NAME with the UserName that was passed to the flow

 

I thought it would be a simple matter of using the compose to replace the characters, but no matter what I try  the USER_NAME string is not been updated. And as a result the API does not return anything.

djox_0-1658940753181.png

 

If I create a test variable in the correct format and pass that to the API my flow works correctly.

 

Am I missing something obvious?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Shujaath_Khan
Super User
Super User

Hi @djox 

 

replace(variables('USER_NAME'),' ','F')

 This is sufficient in compose which should do.

Thanks

Please click Accept as Solution on this reply if it helped to solve your issue, and thumbs-up if you feel this is useful or important in other ways as a boost.

View solution in original post

2 REPLIES 2
Caspar_Rubin
Solution Supplier
Solution Supplier

Instead of using the %32 etc. I usually just create a new String Variable (initialize variable) called "Space" and just put a space in it...

Then i can use this formula: 

 

 

replace(variables('UserName'),variables('Space'),'.')

 


2022-07-27_19h15_30.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Output:

 

2022-07-27_19h17_28.png

 

Shujaath_Khan
Super User
Super User

Hi @djox 

 

replace(variables('USER_NAME'),' ','F')

 This is sufficient in compose which should do.

Thanks

Please click Accept as Solution on this reply if it helped to solve your issue, and thumbs-up if you feel this is useful or important in other ways as a boost.

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!

Top Solution Authors
Top Kudoed Authors
Users online (4,179)