Do you need to convert a string to an integer number in your flow?
Converting a string to an integer is a common task that is often necessary when working with data from various sources.
What looks like a number might actually come into Power Auatome as a string. This might cause errors in your flow in later steps if you are trying to manipulate them as numbers.
You will need to convert these text strings to numbers before you can perform any calculations with them.
This post will show you how to change a text value to a number in Power Automate.
Convert String to Integer
The Microsoft Forms connector is one that commonly causes issues with mixing text and numbers.
In Microsoft Forms it is possible to restrict answers to a number value.
But when retrieving this answer in Power Automate with the Get response details action, it will be a text value.
When you try and use this value in any operation that requires a number, the flow will end in error.
You will first need to convert this value to a number before you can use it as a number.
This is quite an easy fix! You can use the
Int() function to convert a string to an integer value.
The above formula will convert the Number dynamic content in the Compose action, which is from the Get response details action, to an integer.
You will then be able to use the results of this formula as a number.
You can also convert a text to a decimal number using the
Values that are strings when you expect them to be a number are a common problem in Power Automate, especially when using the Forms connector.
Once you identify the issue, it’s an easy fix to first convert the text value to an integer with the Int function.
Have you come across this data type issue before? Let me know in the comments below!