Hello Fred,

With this below piece of code I  do not want to test oField.datatype  and doing 
the sum to n where n  is VAR:currency

procedure tfrmbasePagefo.DoSum(oDbGrid: TDbwidgetgrid; iRow:integer);
VAR  n:currency; nn:integer; iCol:integer; oField:TField;

begin
with oDbGrid,oDbGrid.datalink.datasource do
for iCol:=0 to datacols.count-1 do
 with datacols[iCol]   do
 if  tag>0 then
 begin
  oField:=dataset.fields[tag-1];
  if (oField.datatype = ftinteger)  then
  begin
   tmsebufdataset(DataSet).sumfield(oField,nn);
   
fixrows[iRow].captions[iCol].caption:=format(tnumericField(oField).DisplayFormat,[nn]);
   end
   else
   begin
   tmsebufdataset(DataSet).sumfield(oField,n);
   
fixrows[iRow].captions[iCol].caption:=format(tnumericField(oField).DisplayFormat,[n]);
   end;  end; end;

Regards

Med
________________________________
De : fredvs <fi...@hotmail.com>
Envoyé : mardi 18 mai 2021 13:59
À : mseide-msegui-talk@lists.sourceforge.net 
<mseide-msegui-talk@lists.sourceforge.net>
Objet : Re: [MSEide-MSEgui-talk] BufDataset

Hello Med.

>  In the SRC  of msebufdataset.pas  there is a function to check that (
> checksumfield)  and abort the task.

Hum, in msebufdataset.pas I see a "procedure checksumfield" not a "function
checksumfield":

procedure tmsebufdataset.checksumfield(const afield: tfield;
                                         const fieldtypes: fieldtypesty);
begin
 checkbrowsemode;
 if (afield.fieldno <= 0) or (afield.dataset <> self) or
         not (ffieldinfos[afield.fieldno-1].base.fieldtype in
                                             fieldtypes) then begin
  raise edatabaseerror.create('Invalid sum field
'+'"'+afield.fieldname+'".');
 end;
end;

> Is it possible to change this behavior without changing   source file?

Sorry but I will need more infos to understand.

- What is the goal, do you want the possibility to manage the behavior of
"checksumfield", to not only give (or not) a error message?
- Do you want that "checksumfield" becomes a function and the result is true
or false?
- What do you mean with " without changing  source file", are you talking
about the database file or about the source of the program?

Fre;D







--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to