How do we group in BIRT without wasting lines, and still only printing the group item on the first line?
Asked Answered
C

3

6

When grouping in BIRT, we frequently want the grouping value to show up on the first line as follows:

Group   User                       Reputation
------  ---------------            ----------
Admins  Bill The Weasel                51,018
        Mark Grovel                   118,101
Users   Pax_my_bags_got_to_go          73,554
        Jon Scoot                  **,***,*** <- overflow
        Clueless                       92,928

The normal way of acheiving this is to lay out the group in the designer as follws:

        +---------+--------+--------------+
Tbl Hdr | Group   | User   |   Reputation |
        +---------+--------+--------------+
Grp Hdr | [Group] |        |              |
        +---------+--------+--------------+
Grp Dtl |         | [User] | [Reputation] |
        +---------+--------+--------------+
Grp Ftr |         |        |              |
        +---------+--------+--------------+
Tbl Ftr |         |        |              |
        +---------+--------+--------------+

which, unfortunately, lays out the data in exactly that way, with the grouped value on a different line:

Group   User                       Reputation
------  ---------------            ----------
Admins
        Bill The Weasel                51,018
        Mark Grovel                   118,101
Users
        Pax_my_bags_got_to_go          73,554
        Jon Scoot                  **,***,*** <- overflow
        Clueless                       92,928

This is particularly painful with data where there's lots of groups with only one user since we use twice as much space as needed. If we move the [Group] data item down to the Grp Dtl line, we get it printed for every line in the group.

How, in BIRT, do we merge the two lines Grp Hdr and the first Grp Dtl?

Captivity answered 19/3, 2010 at 1:56 Comment(0)
F
6

The answer below was Mystik's original answer but, try as I might, I couldn't get it to work properly (though I didn't try the second suggestion so it may well work). That may be caused by the fact that I'm running a back level of BIRT (and, no, I'm not allowed to upgrade unfortunately, it's part of a separate product that has its own release cycles).

The solution I eventually found was to leave the data value in the grouping line and select the cell (not the data value), then set the Drop control under Properties, General to be Detail rather then the default None.

This brings the data value down to the detail line when rendering the report.

And I'm editing this answer rather than adding my own since I don't want to be a rep whore :-)


Try following these steps:

  1. Create the group just as you have.
  2. Then drag the group data item one row down (see below). At this point you can delete the group header row if you like.
  3. Then click on the column that has the group data item in it.
  4. Once selected, go the to the properties explorer for the control and scroll to the bottom, selecting "advanced".
  5. In the advanced list, you will see a property called "Suppress Duplicates". Make this true for the column with the Group data in it and you will be all set.

              Supress
             Duplicates
            +---------+--------+--------------+
    Tbl Hdr | Group   | User   |   Reputation |
            +---------+--------+--------------+
    Grp Hdr |                                 |  <-delete this row AFTER Group Creation
            +---------+--------+--------------+
    Grp Dtl | [Group] | [User] | [Reputation] |
            +---------+--------+--------------+
    Grp Ftr |         |        |              |
            +---------+--------+--------------+
    Tbl Ftr |         |        |              |
            +---------+--------+--------------+
    
Farlie answered 19/3, 2010 at 18:1 Comment(3)
This sounds promising. I'll have a look at it on Monday when I'm back at work.Captivity
Nope, didn't work, sorry. I tried it with two nested groups and it still showed values for both columns in all rows.Captivity
Not sure where I went wrong in my instructions, this should be working as I laid it out. I have added a sample to BIRT Exchange that you can download and run. Hopefully seeing it in action will fill in the gaps. birt-exchange.org/devshare/designing-birt-reports/…Farlie
D
1

The previous solution works well, but we didn't find the obvious way to hide inner borders in group header. So that's the solution we found out:

  1. Copy elements from detail row to empty cells in header row.
  2. Initialize loop variable on event onCreate

    i=0; // in onCreate property of group header row

  3. Change conditions in 'Visibility' property editor tab. Check "Hide element" against condition

    i++ == 0

So the final layout will look like:

   +---------+--------+--------------+
   | Tbl Hdr | Group  |    User      |
   +---------+--------+--------------+
   | [Group] | [User] | [Reputation] |
   +---------+--------+--------------+
   |         | [User] | [Reputation] | <-- that's the line that hide first element  
   +---------+--------+--------------+
   |         |        |              |
   +---------+--------+--------------+
Dudek answered 4/3, 2011 at 16:24 Comment(0)
C
0

Select the cell in which group data is entered or placed and select Drop > All instead of None in Property Explorer.

Or select Drop > Detail for cells of another group_data and data_field cells.

Consumption answered 17/9, 2014 at 8:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.