Board index » delphi » Using Filters

Using Filters

Hello All,

I have a question concering Filters and Parent/Child Relationships.

If I allow a user to Filter on fields in the child table, how can I
propagate that up to the parent table?

Lets say the parent table is an Order header and the child is the Order
Detail.  Now, the user filters on an item ID in the order detail because
they only want to see orders that have that item ID.  How can I limit the
Order header to only show those orders?

Thank you in advance
Jim

 

Re:Using Filters


Set a master/slave relationship making the Order Detail the master and the
OrderHeader the slave.

elio

Re:Using Filters


What I do is create a query that returns only the key fields of the
master table with the criteria needed. Something like this:

    Select M.KeyField1,M.KeyField2 from Master M, Detail D where
        M.KeyField1=D.KeyField1 and M.KeyField2=D.KeyField2 and
        D.FieldFiltered = FieldValue

Then I put these key field values in a list and use it in the OnFilter
event of the master table to see if it's in the list returning true if
it is and false if it isn't..

Hope it helps...

Woody

Quote
JAL wrote in message <74p3vt$e...@forums.borland.com>...
>Hello All,

>I have a question concering Filters and Parent/Child Relationships.

>If I allow a user to Filter on fields in the child table, how can I
>propagate that up to the parent table?

>Lets say the parent table is an Order header and the child is the
Order
>Detail.  Now, the user filters on an item ID in the order detail
because
>they only want to see orders that have that item ID.  How can I limit
the
>Order header to only show those orders?

>Thank you in advance
>Jim

Re:Using Filters


You cannot filter one table based on values in another table.  You will have
to use a query to do that.

The only other alternative is to create a 1-1-Many relationship using the
Items table as the master, the Orders table as the middle table and a second
instance of the Items table as the detail.

Bill

--
Bill Todd
(Sorry but TeamB cannot answer questions received via email)
(Remove nospam from my email address to contact me for any other reason)

Other Threads