Hi Barbara,

Now that we finally know that you are looking for Parent records which have no 
Child (related) records, the solution is easy.  What puzzles me is why you 
didn't state this as the problem in the first place?  Thank goodness Michele 
Olson of AppleSauce Productions had the insight to guess the real problem.

On 9/29/07 at 9:40 PM -0500, barbpassman wrote:

> Why can't FMP find all the parent records who have NO related records?
> The way I was trying to do this is by asking FMP to find all parent records 
> wherein the Name fields in the portal are blank ( which means find parent 
> records where there are not related records )

Asking FMP to "find all Parent records wherein the Name field in the Child 
portal is blank" is **NOT** the same as asking FMP to "find all Parent records 
which have no Child (related) records".  Hopefully you now see that these two 
problems are not the same.  The first problem (Name field is blank) will return 
all Parent records which has at least one Child record wherein the Name field 
has no value in that Child record.  Note that the Child record must exist in 
order for us (and FMP) to determine that the field has an empty (or blank) 
value - and this Child record must be related to some Parent in order to return 
the Parent record in the Found Set.


> There are three fields in the portal
> Last Name, First Name and team assignment.
> IF I put the equal sign in the team Assignment field in my FIND view., FMP 
> dutifully brings me every parent record who shows a related record (in the 
> portal) where the team assignment is blank

Exactly - returned a Found Set of Parent records which have at least one Child 
record in which the Team Assignment field is empty.  It did *not* return a 
Found Set of Parent records which had no Child records - which is exactly what 
you expected your original Find (using "=" in the Name field) to do.  In other 
words, if you use "=" in the Team Assignment field, you expect Parent records 
which have Child records wherein Team Assignment is empty; however, if you use 
"=" in the Name field, you expect Parent records which have no Child records - 
not Parent records which have Child records wherein the Name field is empty.  
Why did you expect very similar Serches to produce 2 completely different types 
of results?


> But I cannot use that same logic to find parent records which have no related 
> records.
> I put an equal sign in the First Name and Last name fields in the portal,in 
> the FIND VIeW and FMP tells me there are no records where the portal is 
> empty..
> That is not true.

But that isn't what you asked FMP to Find.  You asked FMP to Find the Parents 
of Child records wherein both the FirstName and LastName fields are empty.  If 
no such Child records exist, no Parents will be returned.  (Also, if such Child 
records exists but they have no Parent record, no Parent record can be 
returned).

You must understand that since you are performing the Find using the Context of 
the Parent table, you are telling FMP to Find the Parents of Child records 
which match the search criteria; it is the Child records which must match the 
criteria.  FMP finds those matching Child records, then uses the join 
(relationship) to move the Found Set of Child records to the Found Set in the 
Parent table occurrence.


> I used an inverse procedure to find my records
> Asked FMP to find all parent records where there was something in the portal.
> Did this by putting the Asterisk in the First Name field
> And also clicking the OMIT RECORDS  option
> 
> I then did a full find  ( command J ) and low and behold, thirty one records 
> appeared where the portal was completely blank... parent records which have 
> no related records.

This is not an "inverse" procedure.  You are asking FMP to OMIT, from the set 
of ALL Parents, those Parents which have at least one Child wherein the 
FirstName field has a value.  So FMP finds all Child records wherein the 
FirstName field has a value, transfers that found set via the join to the 
Parent table occurrence, then OMIT those Parent records from the set of all 
Parents (since you're doing a normal Find vs an Expanded or Constrained Find). 
This will leave (in the Found Set) those Parents which (#1) don't have a Child 
record - or - (#2) whose Child records all don't have a value in the FirstName 
field.  Since all your Child records have a value in the FirstName field, the 
#2 part is empty and you are left with the #1 part - which is exactly what you 
seek - Parents without related Child records.


> Why did I have to  use this route?

Because this is the only route to get the Found Set of "Parents without Child" 
- the way it is and has to be done.

> why did not the simpler "Find records where Name field,in the portal, is 
> blank?

Hopefully you now understand why this Find does not work.
======

To recap the correct way to Find "Parents without Child":

1. assume "Parent" and "Child" table occurrences are joined by Parent::ParentID 
= Child::ParentID
2. "Parents" layout is based on the "Parent" table occurrence
3. Perform an OMIT Find Request with the criteria "*" in the Child::ParentID 
field

Here is a script fragment which implements this search

Parents without Child script fragment:

Go to Layout (Parents)
Perform Find[ Specified Find Requests: Omit Records; Criteria: Child::ParentID: 
"*"; [Restore] ]

This will return all Parents which have no related Child records.

Regards,
Jason L. DeLooze
Annapolis, MD  USA

Reply via email to