on 2010 May 20 9:36 AM
Hi,
There is a cutomization need for field validation on numeric values..
I have a script with me for the field validation butnot able to see the desired out put...
if(hasValue(fieldValue ))
if(fieldValue > 50)
throw doc.createApplicationException(field.getAttributeId(),"should be in bet 50");
The target is ESTIMATED under RFx..
When i am entering 70 it is not throwing any error.. ideally i should throw...
Can anyone suggest any inputs..
Thanks in advance
Regards
Jagmohan
Request clarification before answering.
The fieldValue is not an int but an object of type BigDecimal so you have to use the compareTo() methods in that object to compare its value.
So your code would look like this:
java.math.BigDecimal limit = new java.math.BigDecimal(50.0);
if(hasValue(fieldValue))
if(limit.compareTo(fieldValue) == -1)
throw exception..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Martin,
Thanks for the quick reply... I tried with the same structure, But still not able to get the desired reult (when passing a value greater then the limit) i.e not getting the exception...
here is another code which i tried after yours
import java.math.BigDecimal;
BigDecimal decimalB = new BigDecimal("50.0");
if(hasValue(fieldValue))
if(decimalB.compareTo(fieldValue) == -1)
throw doc.createApplicationException(field.getAttributeId(),"should be in bet 50");
Appriciate your input on this or any other suggestion...
BR
Jaggs
Edited by: JPadhy on May 21, 2010 7:19 AM
Edited by: JPadhy on May 21, 2010 7:20 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.