Delphi 7
Have an oncalcfields event for a virtual table column in a dbgrid. This event wont fire at all.
I can get it to work by putting the code in a browsegridcolexit event, but the problem with that the field gets cleared everytime user exits and unless user re-tabs over certain columns the calculated field is left blank (which is correct).
I have ensured that the calculated field is a persistent field in the fields editor of my virtual table.
Virtual table proprty autocalcfields is set to true.
my procs are as follows...
procedure Tform1.SchdTempTableCalcFields(DataSet: TDataSet);
begin
with datamodule do
if table1.ADSSeek(SInteger(table2.FieldByName('CO').AsInteger,1)+
SInteger(table2.FieldByName('PO').AsInteger,8)+
SInteger(table2.FieldByName('SE').AsInteger,2)+
SInteger(SchdTempTable.FieldByName('LO').AsInteger,3),stHARD) then
if Covunit.ADSSeek(SInteger(table2.FieldByName('CO').AsInteger,1)+
SInteger(table2.FieldByName('PO').AsInteger,8)+
SInteger(table2.FieldByName('SE').AsInteger,2)+
SInteger(SchdTempTable.FieldByName('LO').AsInteger,3)+
SInteger(SchdTempTable.FieldByName('COV').AsInteger,3),stHARD) then
SchdTempTable.FieldByName('LODESC').AsString := table1.FieldByName('ADD').AsString+'/'+
table3.FieldByName('DES').AsString
else
SchdTempTable.FieldByName('LODES').AsString := table1.FieldByName('ADD').AsString;
end;
Appreciate all your help in advance.
msgopala
Have an oncalcfields event for a virtual table column in a dbgrid. This event wont fire at all.
I can get it to work by putting the code in a browsegridcolexit event, but the problem with that the field gets cleared everytime user exits and unless user re-tabs over certain columns the calculated field is left blank (which is correct).
I have ensured that the calculated field is a persistent field in the fields editor of my virtual table.
Virtual table proprty autocalcfields is set to true.
my procs are as follows...
procedure Tform1.SchdTempTableCalcFields(DataSet: TDataSet);
begin
with datamodule do
if table1.ADSSeek(SInteger(table2.FieldByName('CO').AsInteger,1)+
SInteger(table2.FieldByName('PO').AsInteger,8)+
SInteger(table2.FieldByName('SE').AsInteger,2)+
SInteger(SchdTempTable.FieldByName('LO').AsInteger,3),stHARD) then
if Covunit.ADSSeek(SInteger(table2.FieldByName('CO').AsInteger,1)+
SInteger(table2.FieldByName('PO').AsInteger,8)+
SInteger(table2.FieldByName('SE').AsInteger,2)+
SInteger(SchdTempTable.FieldByName('LO').AsInteger,3)+
SInteger(SchdTempTable.FieldByName('COV').AsInteger,3),stHARD) then
SchdTempTable.FieldByName('LODESC').AsString := table1.FieldByName('ADD').AsString+'/'+
table3.FieldByName('DES').AsString
else
SchdTempTable.FieldByName('LODES').AsString := table1.FieldByName('ADD').AsString;
end;
Appreciate all your help in advance.
msgopala