Jump to content
Changes to the Jaspersoft community edition download ×

Prevent merged cells of horizontal subreport if no data source


TheLostDreamer
Go to solution Solved by TheLostDreamer,

Recommended Posts

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 : [
            {$match:{'_id':'{person_id}'}},
            {$unwind:'$aCollection'},
            {$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

Peter

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Solution

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

 

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...