There will be times when you are required to convert a float to integer in Power Automate. In this Power Automate tutorial, we will see how to convert float to integer in Power Automate. So, here we will cover the below topics:
- Convert float to an integer using the Format Number action in Power Automate
- Convert float to an integer using formatNumber() in Power Automate
- Dynamically converts a float to an integer in Power Automate
Convert float to an integer using Format Number action in Power Automate
Here, we will see how to convert float to an integer using the Format Number action in Power Automate flow.
We will create an Instant cloud flow, initialize a float variable, and convert float to an integer using Format number action.
1. Open Power Automate Cloud, then click on the +Create icon -> select Instant Cloud flow.
2. Provide the flow name and select Manually trigger a flow. Then click on Create.
Now, you can see the, “Manually trigger a flow” action is added to the flow page.
3. Next, we will initialize a float variable, for this, click on the +New step -> select the Initialize variable action and then provide the below information
- Name: Provide the variable name
- Type: Select the type as float
- Value: Provide the float number like the below image.
4. Now we will convert the float number to integer, so click on the +New step -> select Format number action, and then provide the below information
- Number: Select the variable from the dynamic content
- Format Provide the format as ‘#’ or ‘N0’
5. Now run the flow manually, and you can see the output of the format number action, float converted to integer in Power Automate.
This is how to convert float to integer using Power Automate.
Convert float to an integer using formatNumber() in Power Automate
Here, we will see how to convert float to an integer using formatNumber() in Power Automate.
We will create an Instant cloud flow, initialize a float variable, and convert float to integer using formatNumber().
1. In Power Automate Cloud, click on the +Create icon and select Instant Cloud flow.
2. Then provide the flow name and select Manually trigger a flow action. Then click on Create.
You can see manually trigger a flow action is added to the flow page.
3. Next, we will initialize a float variable; for this, click on the +New step -> select the Initialize variable action. Then provide the information below
- Name: Provide the variable name
- Type: Select the type as float
- Value: Provide the float number like the below image.
4. Now, we will convert the float to an integer in Power Automate; for this, click +New step, and select Compose action. Then, in the Inputs field, provide any of the expressions that will convert float to integer.
formatNumber(variables('FloatVal'), 'N0')
formatNumber(variables('FloatVal'), '#')
formatNumber(variables('FloatVal'), '###')
5. Now run the flow manually, and the float is converted to an integer in Power Automate.
This is how to convert float to int in Power Automate.
Dynamically converts a float to an integer in Power Automate
Here, we will see how to convert float to integer in Power Automate dynamically.
For example, a SharePoint list contains two columns: Title (Single line of text) and price (Number). Here, we need to convert the price to an integer value of Float type, using formatNumber().
1. In Power Automate Cloud, click on the +Create icon and select Instant Cloud flow.
2. Then provide the flow name and select Manually trigger a flow action. Then click on Create.
Now you can see Manually trigger a flow is added to the flow page
3. We will get items from the SharePoint list; for this, click on the +New step and select the ‘Get items‘ action. Then provide the below information:
- Site address: Select the SharePoint site address
- List name: Select the SharePoint list name
4. Next, click on the + New step and select Apply to each action that will loop through each item in the SharePoint list. Then provide the below information:
- Select an output from previous steps: Select value from dynamic content.
Then click on Add an action, select Compose action, and provide the below information to convert the float number to an integer.
- Inputs: Provide the below information:
formatNumber(items('Apply_to_each')?['Price'], '#')
5. Next, we will update the price value as an integer; for this, click on Add an action and select Update item action. Then provide the below information:
- Site address: provide the SharePoint site address
- List name: Provide the list name
- Id: Select the id from dynamic content
- Title: Select the tile from dynamic content
- Price: Select the output from dynamic content.
6. Now, run the flow manually, and you can see the SharePoint list price column is updated with the integer value.
This is how to convert float to integer in power automate dynamically.
Conclusion
Converting a float to an integer in Power Automate is a very common requirement. In this tutorial, I have explained to you how to convert float to int in Power Automate using the Format Number action and the formatNumber() function in Power Automate.
You may also like:
- Power Automate Number Format
- Power Automate Initialize Variable
- Power Automate convert time zone
- Power Automate Concatenate String
- How to Convert String to Object 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