Board index » delphi » Help needed: Filtering based on calculated fields

Help needed: Filtering based on calculated fields

Seems to be impossible to filter a table based on calculated fields because
OnFilterRecord occurs BEFORE OnCalcFields.  When OnFilterRecord is called,
all calculated fields has null values.

Is there some workaround?
--

- Gabriel Cherem <gabr...@projuris.com>

 

Re:Help needed: Filtering based on calculated fields


Gabriel Cherem <gabr...@projuris.com> wrote in article
<01bcf485$9f843280$32eda296@gabriel>...

Quote
> Seems to be impossible to filter a table based on calculated fields
because
> OnFilterRecord occurs BEFORE OnCalcFields.  When OnFilterRecord is
called,
> all calculated fields has null values.

> Is there some workaround?
> --

> - Gabriel Cherem <gabr...@projuris.com>

Make the expression in the On FilterRecord event then same as the
expression in the OnCalcFields event.

ie pseudo
OnCalcFields

myfield = field1 - field2

..end

OnFilterRecord
Accept := (field1 - field2 > 0)

..end

Other Threads