>>>Is there any way that a generic field-level-validation rule can determine the name of the field being validated?
>>>
>>>The only thing I can think of is to use a naming convention for the validation rules and then check the name of the PROG() running.
>>>
>>>Any other ideas?
>>
>>Our rules have two parameters: field value and a field name. I doubt, what you can obtain this info inside the rule without passing it as a parameter...
>
>That's what I figured.
>
>I'm curious. How do you pass the field value and field name to your rules?
>I'm guessing that your rule for Field1 would be:
>"Field1_Validation(Field1,'Field1')". Is that right?
>Or is it a generic rule
>like "GenericRule(Field1,'Field1')"
>and "GenericRule(Field2,'Field2')" ?
>Why do you pass the field value, can't you just check the value from within the rule?
Here are our rule call and Error for the field:
VARTYPE(ovalid)="O".AND.(Ovalid.nlocked=0.OR.source(complevl,"CompLevl"))
IIF(VARTYPE(ovalid)#"O","Field validation failure in COMPLEVL","")
If it's not broken, fix it until it is.
My Blog