[WD20] - HFILTER() Issue

Startbeitrag von JP am 08.03.2016 08:57

Hi All

I have such a simple problem;

I have a file. It contains many records but 2 records I am interested in. The only difference in the 2 records is a boolean field; one record is set to true, the other record has the field set to false.

I set a HFILTER() condition on the file for the boolean field = True.

I then do a HREADSEEKFIRST() for a record I am looking for. The seek condition is NOT the boolean field, it is on another field. And it still finds the record whose boolean field does not match the HFILTER().

Help says that HFILTER() applies to HREADSEEKFIRST() and so should work. No error occurs when applying the HFILTER().

Why does this not work?



Hi JP,

The help tells you that the filter is only taken into account when the seek involves the key used in the filter. You can use another filter when you use the hkeepfilter constant in the hreadseekfirst command.

I hope this helps.

von M-K - am 08.03.2016 10:33
Hi JP,

It's tricky without seeing the code and the data, but I'd quickly write a query to return the same result set as your HFilter, then "tweak" your HRead... statement to read the query result set e.g. HReadSeekFirst(QRY_YourQuery,...), to see what you get?

I don't use Hfilter any longer; stopped using it way back in the WD11 days, replacing it with queries as I was finding that HFilter is way too slow, has a non-standard syntax and is sometimes difficult to debug ...but "slow" was reason enough for me to stop using it...

von DarrenF - am 08.03.2016 10:38

Thanks, understood.

von JP - am 08.03.2016 12:58

Thanks. I find HFILTER fast enough for our purposes (record counts under 30,000) and if we use it on index fields. But thanks for the feedback.

von JP - am 08.03.2016 12:59
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.