I have a parent table (Series) and a child table (Subscribers). I want to identify, flag, and delete records in the Series table with no corresponding records in the Subscriber table.
One way would be to loop through the Series table and use GTRR to identify parent records with no children by capturing the GTRR error code (101).
Another approach would to add a summary field to the Subscriber table (to get a record count) and use an auto-enter to populate a field in the Series table.
You may want a count-of-children field in the parent table if the record count in the parent table is large, especially if the file(s) is served over WAN. This field should be updated by scripts or auto-entry, again especially if the file(s) is served over WAN. A find for the count-of-children field = 0 will give you the found set you seek.
Since the parent key is indexed in both tables, I might consider creating two value lists. One for the id in the parent table and another value list for the parent key in the child table. Then I would compare the two lists for unique values in the parent value list.
A calculated field in the related table with the function Get(FoundCount) uses internal FMP magic to provide the exact count of records related to the current record. It does not involve any data transfer, so it doesn't care if your related record set is none or 1million.
if you want more details @weetbicks has posted on this in his blog in the past
I created two fields in my related table - one uses the count function and the other uses get found count. Then, I added these fields to my parent layout. They both display the same results. However, I can search on the “count” field but not the “found count” field.
According to Jason Wood on the Community site, “You can search in an unstored field or one without an index (although it is slow because it needs to evaluate the value in every record in the table), but what you can't do is search a related field where the relationship is based on a field without an index.”
I believe this is the case with my layout and the “found count” field.