• Ajith Madathil

How to determine if a string is numeric (in Power Automate)

Updated: Apr 1

There are a few ways that you could do this. Here I will show you two of my 'go-tos'.


Determining if a string is numeric - method #1


The first technique that I would like to demonstrate uses the error handling feature of Power Automate. With error handling, you can define any number of steps to run after the failure of an action.


To replicate this follow these steps:


Step 1: Initialise a variable called ‘IsInteger’ (type boolean).


Step 2: Initialise another variable called ‘IntNumber’ (type string).



Step 3: Use a Compose action to convert the string value into an integer. Use the expression int(variables(‘IntNumber’))



Step 4: Set the variable IsInteger to false if the above compose step fails.



Also set ‘Configure run after 'has failed’ option to true. See below



Step 5: Finally check the If condition whether IsInteger is true or false. Here set Configure run after properties ‘is successful’ and ‘is skipped’ to true.



Below is the completed flow:




Here are my test results.


If the input string is non-numeric:


If the input string IS numeric:




Determining if a string is numeric - method #2


The second technique I want to show you uses the Try Catch Finally flow action.


If you are from a developer background you will be familiar with try, catch, finally statements in your code. If any failure happens within the Try method, the Catch statements will execute. The Finally block is always executed when the execution leaves any part of the Try…Catch statement.


In Power Automate, this is modelled like so:


161 views

Recent Posts

See All

The Compose action

Microsoft Power Automate (aka Microsoft Flow) provides lots of action steps out of the box. My favourite one is Compose. What does it do? What is the Compose action? The Compose action is like a stati

Blog Categories
 

Beginner

Intermediate

 

Advanced

Power Automate Essentials

How can I help you?

I am happy to help at any time.  You can contact me via the official PowerAutomate community forum.  Tag me (@abm) on any post you make there if you would like to me take a look at it.

I am always available for both corporate training or 1-2-1 training for individuals. 

© 2023 by Walkaway. Proudly created with Wix.com

  • Twitter Black Round
This site was designed with the
.com
website builder. Create your website today.
Start Now