+ Start a Discussion
Russel MendozaRussel Mendoza 

Validation rule to accept a 0.00 format

Hi team,

I'm working on a flow on a specific field that will only accept 0.00 format of number. Any number from 0-9 is fine as long as the format is a 3 numbers that has a decimal after first number followed by a 2 numbers format (0.00). 

I'm using the code below but it seems like it doesn't work the way I expected it to be:
REGEX(Text({!ACCEL_OPEN_ANGLE}),"\\b\\d{1}[.]\\d{2}$")

Any help is greatly appreciated.




Any help will be appreciated. Thanks.
Best Answer chosen by Russel Mendoza
BALAJI CHBALAJI CH
Did you gave Decimal places in your Field .?

Check below screenshot of an example:
User-added image

And Validation rule would be:
User-added image

Let us know if that works for you..

Best Regards,
BALAJI
 

All Answers

Alain CabonAlain Cabon
Hi,

Strange way for controlling a numeric value. You can just enclose your formula with NOT ( ) if you want absolutely a regex but that is not the better solution.

ACCEL_OPEN_ANGLE has just a numeric value between 0 and 10 (excluded) with Decimal Places = 2

These formulas are better:

ACCEL_OPEN_ANGLE <= 0 || ACCEL_OPEN_ANGLE>= 10

or

NOT ( ACCEL_OPEN_ANGLE > 0 && ACCEL_OPEN_ANGLE < 10 )

Text(ACCEL_OPEN_ANGLE) of the numeric value 1.00 is equals to "1" thus the regex will never work.

Regards,

Alain
 
BALAJI CHBALAJI CH
Hi Russel,

Please try below formua for the format 0.00:
NOT( REGEX( TEXT(ACCEL_OPEN_ANGLE), "[0-9]{1}+(\\.[0-9]{2}?)?$"))


Let us know if that helps you.

Best Regards,
BALAJI
Russel MendozaRussel Mendoza
Hi BALAJICH,

I tried to use the formula you suggested but it seems like it's accepting every numberical value I put in. Like if I put in 5 numerical number it will accept it. I only need the ACCEL_OPEN_ANGLE to accept any number as long as it remains in the format 0.00. Any format aside from that should be invalid. Thanks for the reply.

Regards,
Russel Mendoza
BALAJI CHBALAJI CH
May I know the Data type of the field ACCEL_OPEN_ANGLE ..
Russel MendozaRussel Mendoza
The data type is number.
BALAJI CHBALAJI CH
Did you gave Decimal places in your Field .?

Check below screenshot of an example:
User-added image

And Validation rule would be:
User-added image

Let us know if that works for you..

Best Regards,
BALAJI
 
This was selected as the best answer
Russel MendozaRussel Mendoza
I Think I got it. Thanks for your help.