It looks like you're new here. Sign in or register to get started.
ravi_navision wrote: Hi, I have 2 fields. Qty1 and Qty2 When user enters on Qty2 field I want to validate Qty2 field sign should be same as Qty1 field sign (Qty1 is non editable and always >0) eg: Qty1 Qty2 +ve +ve Thanks,
ravi_navision wrote: Qty1 is non editable and always >0
ravi_navision wrote: Qty can be Negative
ravi_navision wrote: Thanks for your help David. I wrote one line of code to validate. IF ((Qty1 < 0) AND ("Qty2" >0)) OR ((Qty1 > 0) AND ("Qty2" <0)) THEN Error( ) Just for my interest I want to know is there any other way of doing it.
ravi_navision wrote: Sorry. Small change Qty1 is non editable and not equal to zero
IF (Qty1 * "Qty2") < 0 THEN Error( )
Comments
If Qty 1 is always > 0 then basically you want that Qty 2 is also positive, so
Qty2 := Abs(qty2);
Qty 1 is absolutely irrelevant.
How about you DECIDE what you want THEN we tell you how to code it.
PS a number greater than 0 is positive :whistle:
I wrote one line of code to validate.
IF ((Qty1 < 0) AND ("Qty2" >0)) OR ((Qty1 > 0) AND ("Qty2" <0)) THEN
Error( )
Just for my interest I want to know is there any other way of doing it.
But if Qty1 is always greater than 0 then Qty2 is also always greater than zero so ...
IF "Qty2" < 0 THEN
Error( );
Qty1 is non editable and not equal to zero
Big change actually, but now it makes sense:
try :
Error( )
It works. Thank you David