Fastest way to search in a dataitem

TeeBI for Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Roland
Newbie
Newbie
Posts: 4
Joined: Fri Feb 10, 2017 12:00 am

Fastest way to search in a dataitem

Post by Roland » Thu Dec 14, 2017 11:44 am

Hello.
Can you tell me, what is the fastest way to search for a specific dataitem value.
Lets say I have invoices and invoice positions in a dataitem and want to find all invoiceppositions for invoice xy?
Should I use filters or queries?
Or is any of the possibilites as fast as the other?

Thanks.

Yeray
Site Admin
Site Admin
Posts: 9617
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Fastest way to search in a dataitem

Post by Yeray » Mon Dec 18, 2017 2:37 pm

Hello,

I'd use a Query with a Filter as in the Speed example:

Code: Select all

procedure TBISpeedTest.SQL1_Proc;
var Query : TDataSelect;
    Alex : TDataItem;
begin
  Query:=TDataSelect.Create(nil);
  try
    Query.Add(Persons); // * all fields

    Query.Filter:=TDataFilter.FromString(Persons,'Name="Alex"');

    // Execute Query and after that, just destroy results
    Alex:=Query.Calculate;
    Alex.Free;

  finally
    Query.Free;
  end;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Roland
Newbie
Newbie
Posts: 4
Joined: Fri Feb 10, 2017 12:00 am

Re: Fastest way to search in a dataitem

Post by Roland » Mon Dec 18, 2017 2:41 pm

Ok.
Thanks Yeray.

Post Reply