 # Control Fiels option

In a Table, I have a Boolean Field X.

On X VALIDATE Triger I insert a condition:

IF X = TRUE THEN

A:=0;

Lets supose this:

X default value is FALSE

A= 10;

I Decided change X = TRUE and A becames A=0. Suppose I changed my mind and went back to change the X: = FALSE. How can I say that A:= 10?

Thanks

IF X THEN

A := 0

ELSE

A := 10;

Mohana

Sorry, my example was not the best one! The problem is that A can have different values. I pretend A to have previous values before changed to 0.

Thanks anyway You need to store previous value of A in another variable before changing it to new value.

Create a field PrevX as X and try below code

IF a THEN BEGIN
prevx := x;
x := 0
END ELSE
x := prevx;

Mohana

It all most there, but is not ok Yet :(.

At the moment I have this in Sales Line Table, X field Validate Triger

UnitPrice:=Rec.“Unit Price”;
UCost:=Rec.“Unit Cost (LCY)”;
VAmount:=Rec.Amount;
AmountIncludingVAT:=Rec.“Amount Including VAT”;
UnitCost:=Rec.“Unit Cost”;
LDiscount:=Rec.“Line Discount %”;
LineDiscountAmount:=Rec.“Line Discount Amount”;

IF X = TRUE THEN BEGIN
“Unit Price”:=0;
“Unit Cost (LCY)”:=0;
Amount:=0;
“Amount Including VAT”:=0;
“Unit Cost”:=0;
“Line Discount %”:=0;
“Line Discount Amount”:=0;

END ELSE
IF X= FALSE THEN BEGIN
TESTFIELD(“No.”);
VALIDATE(“No.”);
“Unit Price”:=UnitPrice;
“Unit Cost (LCY)”:=UnitCost;
Amount:=VAmount;
“Amount Including VAT”:=AmountIncludingVAT;
“Unit Cost”:=UCost;
“Line Discount %”:=LDiscount;
“Line Discount Amount”:=LineDiscountAmount;

END;

write this code in IF X = TRUE THEN BEGIN

UnitPrice:=Rec.“Unit Price”;
UCost:=Rec.“Unit Cost (LCY)”;
VAmount:=Rec.Amount;
AmountIncludingVAT:=Rec.“Amount Including VAT”;
UnitCost:=Rec.“Unit Cost”;
LDiscount:=Rec.“Line Discount %”;
LineDiscountAmount:=Rec.“Line Discount Amount”;

Not Yet.

This seems to be so simple and I do not know how to do it.

Lets try again, describng the issue on a different way:

In Sales Lines I Insert a new line with a item Nº Z. When I Insert quantity field, all data in my sales lines record is Filled with all information that becames from Item Record. So far so good.

Lets suppose my boolean field is changed to X= TRUE, so all my sales line record became = 0 on some fields.

QUESTION:

If I chage again X, with value X = FALSE, I want all Sales Line record to be filed agaian with all data sales line information that was there on the first time I insert my sales line.

Thanks