tdatasource

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
medhome
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 18.07.2021, 14:07

tdatasource

Post by medhome »

Hi all,

I have a problem with the event manager of datasource.
I write :
procedure tfrmUserRec (Sender: TObject; Field: TField);
begin
if field =nil then statbar.text:=inttostr( recno)
else
begin
sum:=sum+field.curvalue; //calculated three times
showmessage(field.fieldname); //showed three times;
end;
end;

the record contains fields (NTIERS, DATE, NPIECE, AMOUNT )
FIRST TIME AMOUNT IS SHOWED THAT' S OK BECAUSE IT IS THE FIELD WE CHANGED
SECOND TIME NTIERS ?????????
THIRD TIME NTIERS ?????????

ANY IDEA ? ( THIS CONCERNS FREE PASCAL OR LAZARURUS );
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: tdatasource

Post by marsupilami »

medhome wrote: 25.10.2023, 15:50 ANY IDEA ? ( THIS CONCERNS FREE PASCAL OR LAZARURUS );
I suggest to check that the field name is correct. Something like if Field.FieldName = 'NTIERS'.

As to why this gets called for all fields: This might be a problem in FPC.
medhome
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 18.07.2021, 14:07

Re: tdatasource

Post by medhome »

The field NTIERS is a foreign key and never be changed manualy.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: tdatasource

Post by marsupilami »

I am sorry,

in that case it should be

Code: Select all

procedure tfrmUserRec (Sender: TObject; Field: TField);
begin
  if field =nil then statbar.text:=inttostr( recno)
  else if Field.FieldName = 'AMOUNT' then
  begin
    sum:=sum+field.curvalue; //calculated three times
    showmessage(field.fieldname); //showed three times;
  end;
end;
Post Reply