locked
Validation Rule RRS feed

  • Question

  • Hi Guys,

    It's my first time playing with Table/Field Validation Rules and I'm a bit off here. I want to set up a rule that will not allow data < 0.10 and > 24.00 hours. The field Is DataType: Number, Format: Fixed, Field Size: Decimal, Precision: 6, Scale: 2.

    I'm using the filed to store time from 0.10 to 24.00 hours.

    But, I also need to check the value. The decimal part must be multiple of 10.

    (e.i 0.10, 0.20, 0.30) so on till 24.00

    Is there a way to do that using the Validation Rule?

    Thanks

    SD


    Thanks for everything, all your help is well appreciated

    Monday, October 1, 2012 5:35 PM

Answers

  • If you change the field definition to a precision of 3 and scale of 1, the only numbers that will be accepted are those that fit your rule.  The user can enter 3.14 but the field will take only 3.1.  Perhaps I don't understand what you are trying to do.
    • Marked as answer by scorpdevil Monday, October 1, 2012 8:34 PM
    Monday, October 1, 2012 8:13 PM
  • The Precision property determines the maximum number of digits in total, both right and left of the decimal point.  The Scale property determines the number of digits to the right of the decimal point.  your legitimate values range from 0.1 to 24, so the maximum number of digits in total is 3 and the number of digits to the right of the decimal point is 1.  So setting these properties to 3 and 1 respectively as kech5 advised achieves what you want in that only values to one decimal point can be entered and no more than three digits in total can be entered, though the latter is not really necessary in view of the Validation Rule.  A zero at the second decimal place is numerically meaningless, but can be shown by setting the Format property to #.00

    Ken Sheridan, Stafford, England

    • Marked as answer by scorpdevil Monday, October 1, 2012 8:34 PM
    Monday, October 1, 2012 8:17 PM

All replies

  • Try the validation rule: Between 0.1 and 24.

    If the data must be in increments of tenths, can this be enforced by specifying the precision and scale differently (i.e. 3,1)?

    Monday, October 1, 2012 6:15 PM
  • I got the validation. Now the Incrementation I have no idea.

    Thanks for everything, all your help is well appreciated

    Monday, October 1, 2012 7:07 PM
  • If you change the field definition to a precision of 3 and scale of 1, the only numbers that will be accepted are those that fit your rule.  The user can enter 3.14 but the field will take only 3.1.  Perhaps I don't understand what you are trying to do.
    • Marked as answer by scorpdevil Monday, October 1, 2012 8:34 PM
    Monday, October 1, 2012 8:13 PM
  • The Precision property determines the maximum number of digits in total, both right and left of the decimal point.  The Scale property determines the number of digits to the right of the decimal point.  your legitimate values range from 0.1 to 24, so the maximum number of digits in total is 3 and the number of digits to the right of the decimal point is 1.  So setting these properties to 3 and 1 respectively as kech5 advised achieves what you want in that only values to one decimal point can be entered and no more than three digits in total can be entered, though the latter is not really necessary in view of the Validation Rule.  A zero at the second decimal place is numerically meaningless, but can be shown by setting the Format property to #.00

    Ken Sheridan, Stafford, England

    • Marked as answer by scorpdevil Monday, October 1, 2012 8:34 PM
    Monday, October 1, 2012 8:17 PM
  • Got It!!! Works just fine

    Thanks for everything, all your help is well appreciated

    Monday, October 1, 2012 8:34 PM