You need to sign in to do that
Don't have an account?
Banti
Validation Rule for Multiple Fields
Hi,
i have 20 fields. i,e Day 1, Day2, Day3, Day4....Day20
i need to write a single validation rule for all those fields to allow only 1, 0.5, 0
Please help me.
Thanks
I would suggest to change the field api name to d1__c, d2__c to get minimum number of characters in the formula.
the solution goes like this.
OR(NOT(OR(d1__c=1,d1__c=0.5,d1__c=0)),NOT(OR(d2__c=1,d2__c=0.5,d2__c=0)),........)
HTH
Prabhan
you better to use apex code to display custome message ,ie to guide user exactly which field is failing...
public boolean chk(Double day){
try{
if(day==1 or day==0.5 or day==0){
return true;
}
else{
throw new myException("msg);
RETURN FALSE;
}
}
catch(My Exception){
//display apex message
}
//call method like this
chk(day1__c);
chk(day2__c);
if you like this solution,we can still optimize code...just let me know
Thanks to Praabha , Naveen for your answers.
prabha,
I am entering 0.5 in field..but while saving it is showing 5,00....what to do to overcome this issue.
this is a number field with 17 and 1 as length..
That is strange...
Anyway, why would u define it 17 when u want to store just one character... can u make Length - 1, Decimal Places - 1 on the field definition and check?
That must have been your definition issue.