0

Using Delphi 10.4.1

I'm not having success filtering a TIBQuery, and I'm wondering where I'm going wrong. Hopefully you can point me in the right direction.

Using Interbase 2020, I'm creating these tables in IBConsole.

I have a TIBQuery with two fields:

LocID: integer;  
PerName: string;  //VarChar[35]

The TIBQuery.Filtered property is set to true.

At runtime, I do:

IBQuery1.Filter := 'LocID = ' + IntToStr(ALocID); // where ALocID is integer;

At this point, I would expect to see a filtered record set, but that's not what I'm getting. The entire unfiltered record set is returned.

What am I doing wrong?

1 Answer 1

0

Filter property says how to filter, Filtered says filter or not:

IBQuery1.Filtered := false;
IBQuery1.Filter := <something>
IBQuery1.Filtered := true;
2
  • So you have to turn the filtered property to false, add the new filter, then set Filtered to true again? That's wierd, inconvenient & new. What? Is this easier than...? whatever it was I used a few years ago?
    – WoodGuy
    Jan 19 at 4:26
  • No. Apparently a TIBQuery cannot be filtered. Which is really peculiar since it has a published "Filtered" property. What's that for? What is Embarcadero thinking? But a FireDAC TFDQuery can in fact be filtered and it appears to work well and as expected. So I'll just use that instead.
    – WoodGuy
    Jan 23 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.