AnsweredAssumed Answered

Filter Portal Records Based on Found Set (redux)

Question asked by rmittelman on Jun 17, 2014
Latest reply on Jun 20, 2014 by flybynight

I originally posted this question in https://fmdev.filemaker.com/message/141848#141848.

 

It *seemed* to be answered by erolst, but it is not working dependably for some reason.

 

My solution is based on the Contacts starter solution. I have a Contacts table which contains a SUMMARY field called "Found IDs", which is a list of CONTACT ID MATCHING FIELD, the auto-indexing primary key.

 

The Comm table contains a "Comm ID" auto-indexing primary key, and also the "CONTACT ID MATCHING FIELD" foreign key. The "Comm Type" field is either 1 or 2, indicating the record is either a phone number record or an email address record, respectively.

 

My portal wants to have a list of email addresses, but only those which are relevant to the current found set in the Contacts table. So if I have a list of ALL contacts, I should see those email addresses in the portal, but if I've found a list of only the INACTIVE contacts, I should see only their email addresses in the portal.

 

To accomplish this, I based my portal on the TO called "All Emails", which is an occurrance of the Comm table with a cartesian join to the Contacts table, on the "CONTACT ID MATCHING FIELD" column. The portal filter (suggested by erolst) is as follows:

 

CommType = 2 AND not IsEmpty ( FilterValues ( GetSummary ( Contacts::FoundIDs ; Contacts::FoundIDs ) ; Comm::ContactID ) )

 

The only difference is that I replaced the GetSummary formula with just Contacts::FoundIDs. This seems to work itentically, and the documentation says the GetSummary function only works when the found set is sorted by that field (which it is not in my case).

 

My solution "sort of" works either way, as I tried both versions of the above filter formula. I can filter my Contacts records by: All contacts, Inactive, Active, Board Members, Owe Money, and others. In all cases, when I filter the Contacts data, the FoundIDs field then properly contains the correct list of "CONTACT ID MATCHING FIELD" values.

 

All of the different Contacts found sets I get cause the portal to fill with the proper email addresses, except for when I filter the Contacts for Board Members. In that case, the portal contains all email addresses, not just the board member email addresses. This is obvious when I scroll the portal, as there are 200+ members, and only 16 who are board members. The portal should show 16 email addresses, but it shows 200+ instead. But when I filter for the 5 Inactive contacts, the portal properly shows 5 email addresses.

 

So if the summary FoundIDs list field contains the proper 16 IDs, why isn't it filtering the portal properly? Any ideas?

 

Thanks for the patience it must have taken to read this post.

Outcomes