Do you need to convert a string to float in Power Automate? Then, this Power Automate tutorial will help you to know how to convert String to Float in Power Automate.
Sometimes user enters a float number value in a string data type; the Power Automate flow is considered a text value and not a float number value. In those cases, we must convert the string value to a float value and use it in our flows.
To perform a multiplication with two float values, we require two input values with the number data type.
So the user enters the first input value float number is 2.34 with the text data type and the second input value is 4.34 with the number data type. While performing the multiplication, the flow fails.
To overcome this, we have to convert the first input float value from the text data type to a Float Number value of the Number data type.
Then, we will use the multiplication operation with the two float input values. So, the flow will execute without any errors and display the output value as expected.
Convert String to Float in Power Automate
Let us see how to convert a string to a float number in Power Automate Flow,
1. Create an instant cloud flow; in the trigger action, add two inputs. The first input value is the text data type, and the second input value is the number data type.
2. We will use the float() function inside the flow to convert the String to a Float value.
Add a compose data operation from the action triggers and pass the below expression, which converts the string value to float value.
- float – function name
- triggerBody()[‘text’] – first input value
3. Now we will perform a multiplication with the two float number values.,
- First input value – Converted float value text type to float value number type
- Second input value – Directly passed float number value.
Select the compose data operation and pass the below expression, which performs the multiplication of two float values with a number data type.
- mul – function name
- outputs(‘Compose’) – first input value (converted float value from text data type to float value number data type)
- triggerBody()[‘number’] – second input value
4. Save the flow; Enter the two input values and click on the Run flow option.
Once the flow runs successfully, we can see the flow performs a multiplication with the passed input float values and displays the output value as expected.
This is how to convert a String to a Float Number in Power Automate Flow.
So, I hope you know why we need to convert a string value to a float number in Power Automate. I have also shown you an example of converting the string value to a float number by using the float() function in Power Automate.
You may like the following Power Automate tutorials:
- Format Numbers to Decimal Places Using Power Automate
- How to Format Number to Percentage in Power Automate?
- Convert String to Date for SharePoint list using Power Automate
- How to Split a String between two characters using Power Automate?
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.