0

Column header (of a specific column) should only be displayed/rendered when in that specific column at least one row in detail band has a value.

I have already a variable which counts the rows where this column has a value. When I print this value in the column header band, it shows "null" - (because column header band is evaluated before details). When I print it in the summary band (which gets evaluated after all the details are rendered, then I get the correct value (e.g. 11 rows of this column have value).

I want to use this value in the print when expression of the column header of this specific column (e.g. $V{MeetingPointCounter} > 0).

I have tried already:

--> setting evaluation time of a test text field in column header band to "report" ($V{MeetingPointCounter} is null)

-> setting evaluation time of a test text field to "column" (getting here the correct number in column header band - e.g. 11 - but when I using the expression $V{MeetingPointCounter} > 0 ? true: false within print when expression of the desired header text field (and the evaluation time of this field is also set to column), it still does not get displayed)

-> If I put the following expression in a test text field within column header band: "$V{MeetingPointCounter} > 0 ? true: false" and put the evaluation time to column, I get "true" displayed

-> If I just put "true" statically in the print when expression of the desired column header, this column header gets properly displayed

This is with jasper reports 5.6.0 (can't go to any newer version. This is given by the product we use).

Desired result:

Display/hide column header of a specific column on condition set by its detail column rows.

John Ranger
  • 541
  • 5
  • 18
  • I see you have the additional requirement, "condition of detail of corresponding column", but there are no settings related to this. Hence you need to find a solution to know if columns should be shown or not before (parameters etc). Another solution is to use a dynamic jasper lib like "dynamic jasper" or "dynamic reports". Hence you construct the report directly in java. – Petter Friberg Jun 20 '19 at 11:22
  • @Petter Friberg, thanks for this link. I have seen this before - but as I need another subreport in each detail row which stretches over the whole width of the master report detail band (which I didn't describe here in my question), I cannot use a table (according to my understanding). – John Ranger Jun 20 '19 at 16:42
  • @PetterFriberg As I have no possibility to change any code (I only do the modifications of the jasper report layouts with iReport designer on a finished product of a supplier), I cannot introduce any JAVA library. (I have seen the dynamic jasper lib while doing my researchs). – John Ranger Jun 20 '19 at 16:45
  • Unfortunately I don't think you can solve this, with your requirements. – Petter Friberg Jun 20 '19 at 17:51

0 Answers0