Do you want to convert string to integer in Power Automate? In this Power Automate tutorial, we will see how to convert string to integer in Power Automate.
While a string may appear numeric, it often arrives as a text string in Power Automate. This could lead to errors in subsequent steps of your workflow if you want to perform numerical operations. Therefore, it’s necessary to convert these text strings into numeric values before performing any calculations.
Here, we will cover the topics below
- How to convert string to integer in Power Automate?
- How to convert string to integer dynamically in Power Automate?
Convert string to integer in Power Automate?
Here, we will see how to convert a string to an integer in Power Automate.
For example, I have a number string ‘ 25’, and we need to convert it to an integer; for this, we will pass this string value in the int() function. It gets converted to an integer, and the output will be 25.
Now let’s see how we can do in Power Automate
1. Open Power Automate Cloud, then click on +Create -> select Instant Cloud Flow.
Then, provide a flow name and select the “Manually trigger a flow” action. Then click on Create.
Now, you can see a manual 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. Now, we will convert the string to an integer; for this, click on the +New step -> select Compose action. Then provide the below information:
- Inputs: Provide the below expression:
int(variables('str'))
4. Now run the flow manually; the string is converted to an integer in Power Automate.
This is how to convert a string to an integer in Power Automate.
How to convert string to integer dynamically in Power Automate?
Here, we will see how to convert string to integer dynamically from a SharePoint list in Power Automate.
For example, I have a SharePoint list called product, which contains 2 columns, i.e. Product name and price, both of string type.
We will get all the items from the SharePoint list, and we will convert the price to an integer in Power Automate.
1. Open Power Automate Cloud, then click on +Create -> select Instant Cloud Flow.
Then, provide a flow name and select the “Manually trigger a flow” action. Then click on Create.
Now, you can see a manual trigger a flow action is added to the flow page.
2. Next, we will get all the items from the SharePoint list. Click on the +New step -> select Get items action. Then provide the below information:
- Site address: Provide the SharePoint site address
- List name: Select the list from the dropdown.
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 an integer; for this, click on Add an action -> select Compose action. Then, provide the information below.
- Inputs: Provide the below expression:
int(items('Apply_to_each')?['Price'])
5. Now, run the flow manually, and you can see the string is converted to an integer in Power Automate.
This is how to convert the string to an integer dynamically in Power Automate from a SharePoint list.
Conclusion
In this Power Automate tutorial, we saw how to convert a string to an integer in Power Automate. We can use the int() function in Power Automate to convert a string to an integer.
You may also like:
- Convert a String to an Array in Power Automate
- Convert String to Float in Power Automate
- How to Convert Number to Date in Power Automate?
- How to Convert a Number to Rounding UP or Down in Power Automate?
- How to Convert String to GUID 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