Prevent merged cells of horizontal subreport if no data source

Hello everybody,

As in the title i have a main report with several columns. The column titles are in the mainreport, some of the fields in details are there too and some are subreports.

So one of this columns has in the details a subreport which is horizontal and may have 4 columns. Important is that in this subreport there is only the details band filled.

Now the data source expression  (mongo db) looks kind like this:

runCommand: {
        aggregate : 'person',
        pipeline : [
            {$project:{'_id':1, 'subreportValue':'$aCollection.thevalue' }}

And now to the problem:

If the value "aCollection" exists, everything works fine. There are 1 up to 4 columns filled as they should in the mainreport

BUT ;)

If "aCollection" does not exist the row with the possible 4 subcolumns is merged (in Excel). So there are rows where the colum exists of 4 rows and some in which they are merged. Unfortunatly Excel cannot sort a table with merged fields.

Now i need to know how to create 4 empty fields in the detail band in the subreport anyways also if no data source is existing. I know the options "all sections, no detail" (which does not work because my data is in the detail)

Hope someone has a clue... been working on this bug the whole day

Thanks in Regard


TheLostDreamer's picture
Joined: Aug 8 2013 - 7:15am
Last seen: 9 years 7 months ago

1 Answer:

Found myself the solution:

-set the no data source options to "all selections, no detail"
-Create a column header band with a new field " " (meaning an empty field)
-Set the header band "print when expression" to "$F{subreportValue} == null

So if there are values, the column headers are not printed and only the values are shown

If there are no values the column header band with 4 empty cells is shown in the mainreport, therefore the cells aren't merged


TheLostDreamer's picture
Joined: Aug 8 2013 - 7:15am
Last seen: 9 years 7 months ago