[MSEide-MSEgui-talk] Find

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[MSEide-MSEgui-talk] Find

mohamed hamza
I applied a filter on  a tmseSQL  excluding records to be listed.. After
that I did a find record. This  record is outside the filter and be viewed?

By the way , does the function sumfield apply the filter on summing?


Regards.


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Find

mse
Administrator
On Sunday 16 September 2018 19:36:42 mohamed hamza wrote:
> I applied a filter on  a tmseSQL  excluding records to be listed.. After
> that I did a find record. This  record is outside the filter and be viewed?
>
How did you setup the filter? How do you "find record"?

> By the way , does the function sumfield apply the filter on summing?
>
It looks so:
"
procedure tmsebufdataset.sumfield(const afield: tfield; out asum: double);
var
 int1,int2: integer;
 index1: integer;
 po1: precheaderty;
 po2: pprecheaderty;
 bo1,bo2: boolean;
 state1: tdatasetstate;
begin
 checksumfield(afield,[ftfloat,ftcurrency]);
 index1:= afield.fieldno - 1;
 asum:= 0;
 bo1:= filtered and assigned(onfilterrecord);
 state1:= settempstate(tdatasetstate(dscheckfilter));
 try
  int2:= ffieldinfos[index1].base.offset;
  po2:= pointer(findexes[0]);
  if bo1 then begin
   for int1:= 0 to fbrecordcount - 1 do begin
    fcheckfilterbuffer:= pdsrecordty(pchar(ppointeraty(po2)^[int1])-
                                                           
sizeof(dsheaderty));
    bo2:= true;
    onfilterrecord(self,bo2); <<<<<<<<<<-------
    if bo2 and getfieldflag(@fcheckfilterbuffer^.header.fielddata.nullmask,
                                                             index1) then
begin
     asum:= asum + pdouble(pchar(@fcheckfilterbuffer^.header)+int2)^;
    end;
   end;
  end
  else begin
   for int1:= 0 to fbrecordcount - 1 do begin
    po1:= ppointeraty(po2)^[int1];
    if getfieldflag(@po1^.fielddata.nullmask,index1) then begin
     asum:= asum + pdouble(pchar(po1)+int2)^;
    end;
   end;
  end;
 finally
  restorestate(state1);
 end;
end;
"
(Not tested recently).

Martin


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk