Jump to content
We've recently updated our Privacy Statement, available here ×

how to show records in alternate colors


sudheer

Recommended Posts

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

The best way to get the alternating bands effect in your detail records is as follows:

1.      Drag a Frame element into your detail band.  The default height may be fine if you’re planning on only having a single row of standard-sized text in it, but you’ll probably want to “Adapt to parent width” (one of the formatting tools in the “Formatting Tools Window”).

2.       Place your static text and text fields in the frame.  If you look at the Report Inspector tree, you should see the fields actually appear as sub-elements of the frame.  If you already have elements defined in the detail band outside of a frame and you want them to be inside the frame (not just position-wise, but in a hierarchical sense), the Report Inspector tree lets you drag a field into or out of the frame and also lets you specify the order in which the fields are defined within the frame (which has nothing to do with what position they have on the report).

3.       In the Report Inspector tree, right click “Styles” and choose Add | Style.  A style is created with a default name of “style1”.  Select the “style1” style, and in the “Properties” pane, change the Name of the style to “ZebraStripe” (or "BandedTable", or whatever sounds like a descriptive name for these alternating colors).  Now in the Report Inspector tree again, right click on the “ZebraStripe” style and choose “Add conditional style”.  It automatically creates a conditional style with the Condition Expression “<No condition set>”.  Select this conditional style, and in the Properties pane, set the Condition Expression to    $V{REPORT_COUNT}%2==1   , check the Opaque checkbox, and set the Backcolor to RGB value (153,255,153), which is a light green or whatever color you would like to alternate with white.

4.       As an alternative to step 3, if you already know of a report that defines the ZebraStripe as a style, you can open that report in another tab, right click on the ZebraStripe style in the Report Inspector tree and select “Copy”, then go back to the report you are working on, right click on “Styles” and select “Paste”.  It will automatically copy not only the Style, but also the Conditional Style that is related to it.

5.       Select the frame in the Report Inspector.  In the Properties pane, check the “Opaque” checkbox and change the Style dropdown to “ZebraStripe”.  You should now find that your text fields are sitting in a frame of white or a frame of light green, depending on whether the report count is even or odd.

6.       Note: I used to do this slightly differently.  Instead putting the text fields inside a frame and giving the FRAME the style, I used to select all the text fields in the detail band and give them all the style.  Not only is this more work (if you have more than a handful of fields), but it also means that the fields have to all be exactly touching and extend as far to the right as you want the banding to go.  It was especially a problem if you had some fields that would only print conditionally!  A frame is a much more reliable way to get the alternating highlights for the complete row every time, regardless of the value or position of the individual text fields.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...