cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PeKi72
Post Patron
Post Patron

Remove the zero's from a variable

Dear experts,

I have a compose variable called "A" which has the value: 00012345. Now I want to create a second variable called "B" that removes the zero's from the first compose variable A.

 

I know it has to do something with Float but i am very bad with expressions.

 

Gr. P

1 ACCEPTED SOLUTION

Accepted Solutions
edgonzales
Super User
Super User

It's not really a variable that you've got on the Power Automate side (I know, it's confusing since that's what it's called in Power Virtual Agent. Try this:

In your expression editor type "float(" (without the quotes), then click on the dynamic output of your trigger (probably labeled 'InputC' or something like that....then close out the paren ")".

 

See if that works and let us know.

-Ed

 

 

View solution in original post

5 REPLIES 5
edgonzales
Super User
Super User

@PeKi72 ,

Hey there.  You've got it....  if you just wrap the output of your variable in a float(), it will have the desired result.  Something like this in your expression window (replace the bold bit with the dynamic output of your variable:  

 

float(variables('varTest'))
 
Good work!  Keep us posted.
-Ed
 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

PeKi72
Post Patron
Post Patron

I have an error:

Request to XRM API failed with error: 'Message: Flow client error returned with status code "BadRequest" and details "{"error":{"code":"InvalidOpenApiFlow","message":"Flow save failed with code 'InvalidVariableOperation' and message 'The inputs of workflow run action 'ComposeRemoveZeros' of type 'Compose' are not valid. The variable 'InputC' must be initialized before it can be used inside action 'ComposeRemoveZeros'.'."}}". Code: 0x80060467 InnerError: '.

 

PeKi72_0-1669837286483.png

 

edgonzales
Super User
Super User

It's not really a variable that you've got on the Power Automate side (I know, it's confusing since that's what it's called in Power Virtual Agent. Try this:

In your expression editor type "float(" (without the quotes), then click on the dynamic output of your trigger (probably labeled 'InputC' or something like that....then close out the paren ")".

 

See if that works and let us know.

-Ed

 

 

PeKi72
Post Patron
Post Patron

float(" (triggerBody()['text'])"
I get the expression is invalid
 
 
 
PeKi72
Post Patron
Post Patron

float(triggerBody()['text']) is better 🙂

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
Users online (1,639)