AnsweredAssumed Answered

Alternating formatting on subsummary report sections

Question asked by madoverlord on Dec 7, 2014
Latest reply on Dec 7, 2014 by philmodjunk

Title

Alternating formatting on subsummary report sections

Post

There have been many (usually complicated) solutions to the problem of making a sequence of subsummary sections alternate in format (usually background fill). However the ones I found from googling were not particularly satisfactory, so I played around a bit and noticed a few interesting facts:

1) You can use Let() in field custom formatting expressions to set a global.

2) Custom formatting expressions get executed even if they don't actually have any format changes associated with them.

3) The order of evaluation for fields seems to be what you'd expect, top->bottom, left->right.

So what I did was put the following expression into the custom formatting of a header field (or any field that is at a point where I want to reset the alternation:

Let ( $$UI_REPORT_FLAG = 0 ; 0) // reset alternation flag

And then I stretched the leftmost field of the subsummary so that it spanned the width of the part, moved it to the back, and used custom formatting to set an alternate background, with the following expression:

Let( $$UI_REPORT_FLAG = 1 - $$UI_REPORT_FLAG ; $$UI_REPORT_FLAG)

Works like a charm. Just posting it here so TNPB can find it.

Outcomes