Matt Moran
Matt Moran

Reputation: 707

Erroneous duplicate rows in BIRT report

I have a problem with a BIRT report I'm working on where I have a nested table in the report. The outer table contains data to do with an item on an invoice, while the inner table contains stuff to do with price banding for labor charges. I've written a separate DataSet which gets the inner data, bound by parameters to data in the outer table. Now, when I preview the inner DataSet in BIRT using the defaults I've given it, it returns two rows of data for that bill number & item number - a normal rate & an overtime rate if you like. When I run the report in full over the same data, the outer table stuff is fine, but the inner table just repeats the same row over twice - it's just the first row repeating.

This is sorta what the table looks like in layout view:

Item   Description   Rate       Quantity    Item total
[item] [desc]        [rate]     [quantity]  [total]

...where the price & quantity are in the inner table.

I'd have expected to see something like:

Item   Description       Rate  Quantity   Item Total
1      Callout           $40       1        $40
2      Labor             $30       4.5      $185
                         $50       1        

but instead I get more like:

Item   Description       Rate   Quantity   Item Total
1      Callout           $40       1        $40
2      Labor             $30       4.5      $185
                         $30       4.5        

...even though querying the database & previewing the inner data set based on the same input criteria show the expected result.

Has anyone else had experience like this? I have a hunch it's to do with bindings, but not sure what.

Upvotes: 0

Views: 2332

Answers (3)

Bampfer
Bampfer

Reputation: 2220

One way to get this behavior is by accidentally replacing a table-level binding with a column-level binding.

For example, define a table by dragging a data set into the report. Select the entire table (use the outline view, or select something in the table and then click on the "Table" button that pops up just below the grid.) Then go to the Binding tab. Note that the data set and column bindings are all filled in.

Now select just one field in the Detail row. On the Binding tab, note that the Data Set is blank, and no column binding is shown. Someone who is confused by this (as I was) might then edit the column's binding and specify the same Data Set that was used to create the table. If you do this you will only see a single value repeated in that column when you run the report. (I believe the overridden column is binding to a second instance of the data set, not the one the table is iterating over.)

Upvotes: 2

Matt Moran
Matt Moran

Reputation: 707

I think I sorted it, & this is the most bizarre thing: On the child table I'd been deleting the header & footer row & just leaving the detail row in, in the layout view. Last thing today, just before I was going to go home, I tried again - deleted the table for about the 70th time that day, replaced it, re-did the parameter bindings all exactly as before, but this time I left the header row & footer intact. Clicked the preview tab, voila, all shows up correctly. So, since I didn't need the header or footer on the child table, I went into properties, clicked Hide this element, preview again - all good. No difference to the data bindings, no difference to mappings or anything else, no change to the data sets - the only difference was leaving the header & footer in place but hidden.

Contemplating making a bug report, tbh.

Upvotes: 1

James Jenkins
James Jenkins

Reputation: 1954

Not sure your question can be answered withou looking at the data and the design. But it is important to note that the results you see in the dataset preview, and not neccisarly what you would see if the query was run fully. I have seen difference with 7 records returned. I thought as it was only 7 it would be the same on full run, but it's not. The preview is not just a top 500 query, it has some other (not sure what) filters also.

To problem solve if it is your query or your binding.

If you are using a SQL database. Run the SQL in a SSMS query and see if you get the same results you do when run in the innner table.

Altentively, create a new test report, copy over your dataset and use with a stand alone table.

Upvotes: 1

Related Questions