Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching both parent and child

Status
Not open for further replies.

duffs

Programmer
Sep 22, 2000
48
US
I know this must be a simple thing, but I'm fairly new and can't figure it out.
I have a parent file and a child file. What's the best technique for searching the child file with criteria from both the child and parent files?

Tried from the parent side--searching, putting the unique ids in a global field, and then using gotorelatedrecord to get to the children, but then I couldn't further search the children without getting all children, not just those belonging to the found parents.

Thanks--Susie
 
I take it that the kind of search you want to do is along the lines of -
find all the female children whose father is named 'Fred'?

I presume you have a relationship from child to parent as well as parent to child?
Set up a layout in your child file which has fields for the child criteria plus fields for the
parent criteria. (It is not clear from the FMP documentation that you can do the latter. When you drag the 'Field' thingie into a layout, you can actually choose which file the field is to come from.) Just do a normal search.
Your fields in the above example would be - Gender and Parent::Given Name
Hope this rather garbled explanation helps.
Paul

Cheers,
Paul J.
 
Thanks, Paul.

Actually, I was trying to do the search in 2 steps. In your analogy, I have about 5 or 6 different places where I was trying to find a father of Fred; in one case, female children, in another male, in another those named Smedly, etc. I was trying to be structured and not reproduce the finding of Fred in multiple places.

The best answer I got which seems to work fine is to first find the parent, then go to related records of the children. Loop through these, omitting the ones that don't match the additional criteria. So now I have a single script in the parent called FindFred that I can call from multiple scripts within the parent. In each script, the thing that varies is which child file I go to and which child script I call to further narrow the records.

--Susie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top