4 Replies Latest reply on May 15, 2017 7:32 AM by piaccounting

# VALIDATION : Quarters (Fractions)

Does anyone know if there is a simple validation or function to restrict an entry field to quarters (as decimals) in other words .00; 0.25;
0.50 or 0.75?

In the absence of a direct function I suppose you could test the decimal part and then either fail it or suitably round it; the latter being
easier said than done, I fear.

Many thanks for any thoughts.

Dave

• ###### 1. Re: VALIDATION : Quarters (Fractions)

Round ( self * 4 ; 0 ) / 4

would automatically round to the nearest 4th.

Round ( self * 4 ; 0 ) / 4 = self

would validate

1 of 1 people found this helpful
• ###### 2. Re: VALIDATION : Quarters (Fractions)

Here is a direct way of testing the decimal part.

Let([

fracPart = inputNumber - Int(inputNumber)

];

Case(

fracPart = 0; 1;

fracPart = 0.25; 1;

fracPart = 0.50; 1;

fracPart = 0.75; 1;

0)

)

Note that this tests if the field has a fractional part (after the decimal) of round quarters.  It does not test anything about the integer part of the inputNumber.

If you do need to test if the entire field is 0, 0.25, 0.5, 0.75 and nothing higher, change to have

fracPart = inputNumber

-Tom

1 of 1 people found this helpful
• ###### 3. Re: VALIDATION : Quarters (Fractions)

Now that was so much easier than I had imagined. Silly me. Thank you.

• ###### 4. Re: VALIDATION : Quarters (Fractions)

Hi Tom

Thanks - will test that out in excel too!

Dave