How to check if a variable is integer or float or decimal in Power Automate

Hello everyone and welcome to my blog. In today’s blog, I will discuss a very simple requirement to check if a variable is an integer or float or decimal.

Many a times we have the requirement to check the type of variable. Depending on the type whether it’s an integer or float or decimal, we need to take decision accordingly.

I will take a similar requirement for this blog. I will check if the variable is a number. If it is a number then I will convert it to an integer.

I declared a variable ‘varX‘. As you can see from the below illustration, the value is alphanumeric.

I need to check if this value is a integer. Quite unknown to many, there is an out-of-box function in Power Automate isInt. The isInt function takes a variable as input and returns true or false.

Below is an illustration where isInt function is used in a condition expression.

isInt(variables('varX'))

If the input value is number, the expression value will return true. And then you can use the int() function to convert the text variable into a number.

So that’s about integer or number data types. How about checking whether it is a float or decimal type.

There is no similar function for decimal. However there is a function isFloat to check for floating data types which should take care of any number with decimal points.

Below is an illustration of isFloat function.

Hope this helped. To stay updated with similar interesting topics, please subscribe to my blog.

Debajit Dutta
Business Solutions MVP