Do you want to convert string to float in Power Automate? In this Power Automate tutorial, we will see how to convert string to float in Power Automate.
Converting a string to a float in Power Automate means changing a piece of text that looks like a number into an actual number so that Power Automate can use it.
In Power Automate, sometimes what seems like a number is actually treated as text. This can lead to problems in workflow when we want to do calculations or other operations with these values in Power Automate.
To convert a string to float in Power Automate, we will use float(), which will take the value as a string and convert it into float in Power Automate.
Syntax
float(string, locale)
Here, we will see the topics below
- How do you convert string to float in Power Automate?
- How do you convert string to float dynamically in Power Automate?
Convert string to float in Power Automate
Here, we will see how to convert string to float in Power Automate.
For example, we have a string ‘234.56’, and we will convert it into float using float() in Power Automate. The result will be 234.56.
1. Open Power Automate Cloud, then click on +Create -> select Instant Cloud Flow.
Then, provide a flow name and select Manually trigger a flow action. Then click on Create.
Now, you can see the “Manually trigger a flow” action is added to the flow page.
2. We will initialize a string variable, for this click on +New step -> select Initialize variable action. Then provide the below information:
- Name: Provide the name of the variable
- Type: Provide the type as a string
- Value: Provide the value like below
3. We will convert the above string to a float; for this, click on +New step -> select Compose action and then provide the information below.
- Inputs: Provide the below expression
float(variables('str'))
4. Now save and run the flow manually. You can see the string is converted to float in Power Automate.
This is how we can convert string to float in Power Automate.
Convert string to float dynamically in Power Automate
Here, we will see how to convert the string to float dynamically from SharePoint in Power Automate.
For example, I have a SharePoint list called Product, which contains two columns i.e., Product name and Price, both are of single line of text.
We will get the items from the SharePoint list, and we will convert the single line of text to float in Power Automate.
To do this in Power Automate, follow the below steps:
1. Open Power Automate Cloud, then click on +Create -> select Instant Cloud Flow.
Then, provide a flow name and select Manually trigger a flow action. Then click on Create.
Now, you can see the “Manually trigger a flow” action is added to the flow page.
2. Now we will get items from the SharePoint list; for this, click on the +New step -> select Get items action. Provide the below information:
- Site address: Provide the SharePoint site address
- List name: Provide the list name
3. Next, we have multiple items in the Sharepoint list; for this, click on +New step -> select Apply to each action. Then provide the below information:
- Select an output from previous steps: Select value from dynamic content.
4. We will convert the string to float; for this, click on Add an action -> select Compose action. Then, provide the information below.
- Inputs: Provide the below expression:
float(items('Apply_to_each')?['Price'])
5. Now run the flow manually, and you can see the string is converted to float type in Power Automate.
This is how to convert string to float in Power Automate dynamically.
Conclusion
In this Power Automate tutorial, we saw how to convert a string to float in Power Automate. Also, we saw how to dynamically convert a string to float in Power Automate.
You may also like:
- Convert Percentage to Whole Number in Power Automate
- Convert a Number to Hexadecimal in Power Automate
- Convert Number to Date in Power Automate
- Convert Decimal to Integer in Power Automate
- Convert a String to an Array in Power Automate
- How to Convert String to Decimal in Power Automate?
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com