Alright, I admit it—this item on conditionally formatting sections has a little nostalgia for me, but it’s useful nostalgia. If you run a web search for “greenbar paper” you’ll see where this is going. The reason is a sound one, though. The horizontal stripes, sometimes called “banded rows”, let the user see what’s in which row of a report, or other printout, more easily.
The first step, after setting up the report and laying out the data, is to create a Details “b” section in the report—with no data in it. Right-click the section name, and “Insert Section Below”.
The only thing we want to do there is create a horizontal box, borderless, of any light fill color (since it’s going behind some of our data) in the same place as the data will be. Take your time when drawing. The box should be the same height as the section, or just a hair less.
The slightly more complex part comes with the conditionally formatting portion of the recipe. We want this color background to show up behind every other record. Luckily, the formula is simple. We go into the Section Expert, click the X+2 button for “Suppress (No Drill-Down)”, thus into the Formula Editor for the section, and type RecordNumber Mod 2=0. Basically, this function looks for even-numbered records/rows by doing the division, and if the remainder is 0, the color details section is suppressed. So…on, off, on, off. The conditionally part being, even- versus odd-numbered rows.
Finally, still in the Section Expert, we go to the Details A section and check Underlay Following Sections, so as to get them to overlap (or underlap, as the case may be).
Granted, we don’t usually print much on 15-inch wide pinfeed carriage paper in high-speed dot-matrix printers anymore. But with the density of content in some reports, stemming from smaller print sizes and such, you never know when this trick might come in handy.
Ah, nostalgia. “Everything old is new again.” And still useful.
To learn more, try our Crystal Reports classes.