dbTalk Databases Forums  

Count the related records of a found set

comp.databases.filemaker comp.databases.filemaker


Discuss Count the related records of a found set in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Howard Schlossberg
 
Posts: n/a

Default Re: Count the related records of a found set - 07-05-2011 , 12:26 PM






On 7/4/2011 1:14 PM, Christoph Kaufmann wrote:
Quote:
Howard Schlossberg<howard (AT) nospam (DOT) fmprosolutions.com> wrote:

But another way would be to use the List() function to get all
ParentID's from the child table. Then use a valuecount() of
UniqueValues() to determine the number of unique parent IDs.

Great. It's like Helpful Harry's approach, enriched with the list
function that doesn't exist in v5.5 :-)
And the UniqueValues() custom function that couldn't have existed in 5.5
either. ;-(

Reply With Quote
  #12  
Old   
Your Name
 
Posts: n/a

Default Re: Count the related records of a found set - 07-05-2011 , 04:22 PM






In article <1k3xp9l.14aqhzv1y9bhzaN%clk (AT) tele2 (DOT) ch>, clk (AT) tele2 (DOT) ch (Christoph
Kaufmann) wrote:

Quote:
Helpful Harry wrote:

Create a Relationship in the child table to group the related records.
e.g.
rel_SameParent
match record in ChildTable with records in ChildTable
when ParentKey = ChildTable::ParentKey

Then you can create a Calculation Field which works out each record being
1/xth of the total number of same parent records.
e.g.
OneXth Calculation, Number Result, Unstored
= 1 / Count(rel_SameParent::ParentKey)

If you were to then create a Summary Field and Summary Report totalling
these values, you would get a total of 1 for each different ParentKey
sub-summary. Which also means to get the number of unique parent records
you can simply summarise them all
e.g.
s_NumParentRecords Summary
Total of OneXth

I'm afraid that this method, too, works only if I have every record of
the table in the found set, because the totalling depends on the found
set, the count of the child records with the same parent, however, does
not.
Sorry, I was assuming that the Found Set contained all the related records
from another message about the Go To Related Records command.


You could try creating a Relationship from the Child Table back to the
Parent Table (if there isn't one already) using the same key field, and
then using the List function to obtain the list via that Relationship and
counting those values.
i.e.
PatternCount[List[RelationshipToParent::KeyField]; "P"]] + 1

where P is really the backwards-P carriage return symbol.

Otherwise I think the only way you'll be able to get a "count" of the
unique Parent Records for a Found Set will be to use a Script.

Helpful Harry )

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.