CodePudding user response:
Database triggerOr
Add function fields
CodePudding user response:
If set up two fields: "base" "profits" :Use DBEdit1 corresponds to "base", the use of DBEdit2 corresponding "profits",
In DBEdit1. OnChange events:
Procedure TMyFrm. DBEdit1Change (Sender: TObject);
Var N: Double;
The begin
With DataModule1. ClientDataSet1 do
The begin
N:=FieldByName (' base '.) asFloat;
If (N> 0) and (N<1000) then N:=N * 0.05
The else begin
If (N>=1000) and (N<2000) then N:=N * 0.1;
The end;
Edit;
FieldByName (' profits'). AsFloat:=N;
Post;
The end;
The end;