Alpha Video Training
Results 1 to 2 of 2

Thread: Filter Parent With Child

  1. #1
    Jamin Dunivan
    Guest

    Default Filter Parent With Child

    I have form linked to a set. I want to query all records that have a record in the child table. Would I use flattenquery for this:

    Example:
    1 John (Child contains X records)
    2 Jane (Child contains no records)
    3 Bob (Child contains X records)

    What I want to do is make a button that will query the form linked to the set to show only those parent records that have child records so my output woud look like this

    1 John (Child contains X records)
    2 Bob (Child contains X records)

    "Jane" would not show because she has no records in the child. This is probably easy but I'm on brain fry.

    Jamin

  2. #2
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Filter Parent With Child

    One way to do this is to define a query "operation".

    Using the invoice database that shipped as a sample by Alpha Software, I chose the Vendors Set. This uses a 1:Many link between vendor table and product table.

    I defined a new operation to be based on this set, to query records.

    I specified vendor_id as the field (from the parent table, Vendor). And, exist(vendor_id,"Products.dbf","vendor") as the condition.

    When the new operation is run, a query is performed against the set, and parent records are included only if they have a related child record.

    This was verified by adding a new vendor to the vendor table, without adding any related product records in the product table. The new vendor is excluded from the query view created by the new operation.

    Hope this helps.

    -- tom cone

Similar Threads

  1. Parent/Child
    By bmann3 in forum Alpha Five Version 6
    Replies: 4
    Last Post: 07-15-2005, 02:00 PM
  2. Parent - child
    By Jan Nielsen in forum Alpha Five Version 5
    Replies: 6
    Last Post: 03-08-2004, 04:03 AM
  3. Should -Can- a parent be it's own child?
    By Scott Axton in forum Alpha Five Version 5
    Replies: 4
    Last Post: 09-02-2003, 05:11 PM
  4. Can Parent be a Child?
    By Jeff Stevens in forum Alpha Five Version 4
    Replies: 1
    Last Post: 03-04-2003, 06:50 PM
  5. Update child recs bases on parent filter
    By Michael Humby in forum Code Archive
    Replies: 1
    Last Post: 05-05-2002, 02:33 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •