Translate

Freitag, 5. Februar 2021

Jasper Reports Studio - Print when expression used for subreport

Environment: JR Studio 6.1.1 - APEX 20.2

Challenge:
I have one main report with 3 subreports and I like to print certain subreports depending on certain conditions.

My Main Report looks like:














In the detail bands 1,2,3 you see my SubReports A,B,C

within my sql query for the mainreport I put a case condition like:

case
   when HV_ABRECHNUNG.TAGE_ANTEILIG > 0 then 'Ja' else 'Nein'
end PRINT_Anteilig,  .....

For development and control purposes I put the result into a field marked (1). Later I delete this.

Then I used the "PRINT WHEN EXPRESSION in Jasper Reports Studio for the detail bands B and C (not to the subreport !!!).

You'll find these under Properties --> Appearance ... (click on the edit pencil):


































Expression:

new Boolean($F{PRINT_ANTEILIG}.equals("Ja"))

So this I applied to detail band 3 or C

and for detail band 2 or B I put in the expression editor:

new Boolean($F{PRINT_ANTEILIG}.equals("Nein"))


Good luck !!



Keine Kommentare:

Kommentar veröffentlichen