Today we’re going to look at a new feature in FileMaker 13: the summary list field.
Summary list fields allow developers to easily access a list of field values from records in a found set. In this case, the summary list field is pointing at the primary key field in Customers, and if we have three records in our current found set, then zz_s_id_list will return something like this:
C00731 C03434 C03616
When the found set changes, the list of values in zz_s_id_list will immediately and automatically update, and one obvious use of this feature is to construct multiline relational keys (a.k.a. “MLKs”) . In today’s demo file, FM 13 Summary List – MLK, v1, we have a simple invoicing system, constructed like so:
…and we want the header in Customers to dynamically update as the found set changes.
Unfortunately we can’t use a summary field as a relational predicate, so let’s define a calculated field with a text result, to echo the summary list field.
Next we’ll throw some extra table occurrences onto our Relationships Graph, and link them up like so:
In case you’re wondering, “cfs_” stands for “customer found set”, and here’s what’s going on in the header:
To get the header info to update reliably, I had to use a “refresh window (flush cached join results)” script step in a couple places:
- As an OnRecordLoad script trigger
- As part of a scripted custom menu replacement for “Show All Records”
One other aspect of this technique perhaps worth mentioning: it allows us to look before we leap vis-a-vis “go to related record”, so the navigation buttons…
…can “gray out” when there are no related records to go to, and our scripts can trap for this proactively…
…whereas if we instead rely on “match all records in the current found set”…
…we have no way of knowing before hand whether the step will be successful or not. We have to “leap” (go to related record) first, and then take corrective action if the step fails (e.g., if we don’t end up on an invoice layout).
In an upcoming posting, we’ll continue our exploration of summary list fields.