cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
VSJadhav
Helper II
Helper II

Add 10 digits numbers into #######-##-# format

Hi Team,

Am using PowerApps portal application where am getting records from excel.
I want to check whether input field value is digit or not.
If its 10 digit number and does not have "-" present in specific places then add it else check whether "-" present in required places or not. If "-" present in wrong places then stop the flow and show error.

The required input to proceed ahead is #######-##-# or ########## and it should have digits only.

Please let me know how to create MS Flow for this.
Thanks,
Vaibhav

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User III
Super User III

Hi @VSJadhav 

 

Follow the below steps:

 

image.png

 

Next section describes the No condition steps

 

image.png

 

Above I have used formatNumber expression.

 

formatNumber(int(variables('Number')),'#######-##-#')
 
Above I am using the error handler technique to verify whether the number is numeric or not. As you can see above the formatNumber have int() expression. If thats not a number this is going to fail.
 
Next below steps are for the Yes part of the condition.
 
image.png
 
Above formatNumber() expression is as follows:
 
formatNumber(int(replace(variables('Number'),'-','')),'#######-##-#')
 
Same error handling technique I used to determine the whether the number is numeric or not?
 
Note:
 
To set the error handling technique you need to set the following. Click the configure run after then select the option 'has failed'.
 
image.png
 
image.png
 
Above same technique you need to use for Compose 6 as well.
 
Thanks
abm_0-1616803211117.png

 

 
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

View solution in original post

2 REPLIES 2
mahoneypat
Solution Sage
Solution Sage

Checking if a string is an integer is sadly not easy in power automate.  However, here is one way to check your input for a 10 digit number.  Also, see this article for how to configure the run after where shown (after the is10digitnumber step).

 

Microsoft Flow – How to determine a string is numeric? | @mydevexperience #Flownaut Super User III (...

 

This flow replaces '-' with '', check if the string length is 10, and then also tries to check if the int( ) of that string is >0.  The IsInteger variable is initially set to true and set to false only if the Is10digitnumber step fails.  The condition then checks that IsInteger is still true and that the number is 10 digits.

 

mahoneypat_0-1616801288524.png

 

Key Expressions Used Above

 

Is10digitnumber step - 

and(equals(length(replace(outputs('InputText'), '-''')), 10), greater(int(replace(outputs('InputText'),'-','')),0))
 
Condition control - 
and(equals(outputs('Is10digitnumber'), true), equals(variables('IsInteger'),true))

 

Pat

abm
Super User III
Super User III

Hi @VSJadhav 

 

Follow the below steps:

 

image.png

 

Next section describes the No condition steps

 

image.png

 

Above I have used formatNumber expression.

 

formatNumber(int(variables('Number')),'#######-##-#')
 
Above I am using the error handler technique to verify whether the number is numeric or not. As you can see above the formatNumber have int() expression. If thats not a number this is going to fail.
 
Next below steps are for the Yes part of the condition.
 
image.png
 
Above formatNumber() expression is as follows:
 
formatNumber(int(replace(variables('Number'),'-','')),'#######-##-#')
 
Same error handling technique I used to determine the whether the number is numeric or not?
 
Note:
 
To set the error handling technique you need to set the following. Click the configure run after then select the option 'has failed'.
 
image.png
 
image.png
 
Above same technique you need to use for Compose 6 as well.
 
Thanks
abm_0-1616803211117.png

 

 
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

View solution in original post

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (71,476)