Summary List Fields in FM 13, part 1

Today we’re going to look at a new feature in FileMaker 13: the summary list field.

1-18-2014 11-56-42 PM

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:

1-19-2014 12-38-56 AM

…and we want the header in Customers to dynamically update as the found set changes.

1-19-2014 12-43-05 AM

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.

1-19-2014 12-32-56 AM

Next we’ll throw some extra table occurrences onto our Relationships Graph, and link them up like so:

1-19-2014 12-37-03 AM

In case you’re wondering, “cfs_” stands for “customer found set”, and here’s what’s going on in the header:

1-19-2014 1-35-49 AM

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:

  1. As an OnRecordLoad script trigger
  2. As part of a scripted custom menu replacement for “Show All Records”

1-19-2014 9-46-29 AM

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…

1-19-2014 1-57-04 AM

…can “gray out” when there are no related records to go to, and our scripts can trap for this proactively…

1-19-2014 2-18-32 AM

…whereas if we instead rely on “match all records in the current found set”…

1-19-2014 2-24-05 AM

…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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s