One of my favorite FileMaker functions is GetSummary; I use it frequently, and it had never occurred to me that there might be any alternative. Recently, however, Mikhail Edoshin pointed out on the FMPExperts list that GetLayoutObjectAttribute can serve as a viable replacement, like so:
I threw together a demo file, ForgetSummary, to compare the performance of GetSummary vs. GetLayoutObjectAttribute…
…and was pleasantly surprised to discover no significant difference between the two methods, either locally, or on a WAN. Note: if you want to test this on a WAN, start with a small number of order records in your found set. You don’t want to wait for 21K records to sort on a WAN. Also make sure to close and reopen the demo file between tests, to rule out caching… otherwise one method will appear to be significantly faster than the other.
If the resulting report (or under-the-hood scripting) looks familiar…
…you may recognize it from when we examined Fast Summaries a couple years ago.
Given that the two methods perform about the same, is there any reason to prefer one over the other? As usual with these articles, I learned something in the process of creating and debugging the demo, and also clarified my thinking during the writing process. Since the report is based on summarized order data, grouped by vendor, and since GetSummary requires that the “break field” live in the active table (i.e., orders), I had convinced myself that it was necessary to create a FileMaker 6-style “pipeline” calc to get the vendor name into the order table.
But that actually isn’t true at all… as long as your vendor names (and of course vendor primary keys) are unique, if you want to use GetSummary you can do a two-level sort like so…
…and then use order::id_vendor as the GetSummary break field. So no need to create a pipeline calc after all. And no need to make any layout-level schema changes either. The script pretty much takes care of everything.
Meanwhile, if you want to use the GetLayoutObjectAttribute method, you will need to a) assign one or more object names, and b) have a layout somewhere with a sub-summary part, as per this example from our demo:
It will be interesting to see what clever uses people come up with for this technique.