What you can do is include multiple sub summary parts in the same layout--each specifying a different break field. You can then get a number of different reports from the same layout simply by sorting your found set on different combinations of these break fields.
I recently set up a report for my employer where the same report layout can show just the sub totals, or list the individual items under each sub total's heading using this method. What looks like a body layout part is really another sub summary layout part that specifies the primary key as it's break field. If I sort the records, including the primary key as the last sort field, the individual details appear. If I sort them again omitting this field, the individual details disappear....
Thanks for this, it works great and I've set up a three part report with scripted sort filters and it's going everything I envisaged....
There is one question I have and this is only due to the nature of the information being shown that it's cropped up.
Because I've got static fields to show staff, customer and task, when I sort by one of these, there's always the static version of the same data showing within the detail of the sub summary group.
What I'd like to do is make this detail dynamic as well so that when I'm sorting by 'A', I don't see 'A', but instead see 'B' and 'C'. When I'm sorting by 'B', the dynamic field(s) change to 'A' and 'C'.
I've tried a couple of things with variables but they've not worked so far, although I think that might be a way to go.
Have you ever done or seen anything similar?
If you use a script to sort your records in the different orders, that script can set variables or global fields to a value that indicates the specified sort order. Then you can use calculation fields or a "stack" of fields with "hide object when" expressions to display different data with different sort orders specified by your script.
Thanks for that, works great - I've steered clear of the Hide Object When and instead opted for calculation fields which vary the data in a given result field based on the value of the sort variable.