cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ratanapouy
Helper III
Helper III

Validate 2 decimal number in form

hi,

 

in SP list, number field is only 2 decimal. Example: user input 2.45523, it becomes 2.45

I am using Powerapps form to send field number to SP list, i want to set validation only 2 decimal number is accept it if it is wrong format, show an error message.

Number Format.png

 

How to set a validation?

 

Thanks,

Ratana

1 ACCEPTED SOLUTION

Accepted Solutions
RezaDorrani
Dual Super User II
Dual Super User II

Hi @ratanapouy 

 

Use this

IsMatch( TextInput.Text,"\d+(\.\d{0,2})?")

This will return true or false for your scenario

accordingly display error message or hide your submit button

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

4 REPLIES 4
ProNewbie
Advocate II
Advocate II

Hi, in the Text property of the element you can try this formula :

Text(Value(ThisItem.SPColumnName;"en-US"), "[$-en-US]$ #,##0.00")

 

https://docs.microsoft.com/it-it/powerapps/maker/canvas-apps/functions/function-text

 

ProNewbie

RezaDorrani
Dual Super User II
Dual Super User II

Hi @ratanapouy 

 

Use this

IsMatch( TextInput.Text,"\d+(\.\d{0,2})?")

This will return true or false for your scenario

accordingly display error message or hide your submit button

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

v-yutliu-msft
Community Support
Community Support

Hi @ratanapouy ,

I suggest you set the submit button's OnSelect:

If(IsMatch( TextInput.Text,"\d+(\.\d{0,2})?"),   //justify whether meet the format
Submit(Form1), //submit the form if the result is true
Nodify("wrong format",NotificationType.Warning)) //display Notification if the result is false

Here's a doc about IsMatch function for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-ismatch

You could change the format inside the formula based on your demands.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

How do I only limit SQL NUMERIC(7,5) datatype in Power apps. I would like to limit my users to input max value of 99.99999

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,434)