Level: Intermediate, Version: FM 12 or later

Boxed Summary Groups for Reports

Demo file:  boxed-summary-groups.zip

Recently I needed to produce a summary report with variable height rows and each group enclosed in a rectangular box. To make the challenge more interesting, there were multiple fields in the body part, and it was not known in advance for any given record which would be tallest. At any rate, the approach I decided to go with took a bit of trial and error to get working and I figured I’d share the process here in case anyone else finds it useful.

To see this in action, open the demo file, click “Display Report”…

…and the report will open in preview mode in a new window.

When you are done admiring the boxed summary groups, click Continue and you will be given the opportunity to output the report as a PDF.

Okay, let’s explore behind the scenes. For aesthetic reasons I ended up making two versions of the report layout, one for Mac and one for Windows, the only difference being a slight variation in the positioning of the vertical lines. On the Mac version of the layout it’s easier to see what’s going on so let’s look at that one.

As per the dialog, the layout has a body part, as well as leading and trailing sub-summaries, both of which are sorted on the group field.

The basic idea here is to have a body part that is taller than the largest amount of data you will ever have in any of the fields on the layout. In this case the body is 500 pt, and the two merge fields are each 494 pt in height positioned like so, with 3 pt of breathing room above and below.

We also have a pair of vertical lines which are 510 pt in height, and extend from the top of the body into the trailing grand summary. One feature of the current design surface (introduced in FM 12) is that objects will only render in the part they originate in, but extending the lines into the trailing sub-summary will help ensure that they do what we want them to do.

To be clear, the lines only need to extend a tiny bit into the sub-summary — they would work equally well if they were 501 points high, but they must “transcend” the body part by at least one point. Reminder: the lines originate in the body part so that is the only place we will see them when we generate the report.

The other essential component of the technique is that all body objects must be set to slide up and shrink like so.

Of course boxes have horizontal lines as well as vertical ones so let’s talk about those. The upper horizontal box line is implemented via the leading sub-summary part…

…the lower horizontal line is implemented via the trailing sub-summary part…

…and, of course, we should ensure all four lines have the same color and weight.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.