Jump to content
Changes to the Jaspersoft community edition download ×

Why in the report if you use the print when expression section, the band no data section will not run in any way?


imanpu13562

Recommended Posts

Hello, I'll show a report with two subreports, which will be displayed by the user input parameters of each of the subreports, that is, the print-expression for it. This report also performs both main report and subreport in various conditional conditions, but the band no data section, while not in the section when no data type is set to the no data section option? In addition, the report language is set to the groovy report that works. Please find out how to enable band no data?

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

The "No-Data-Section" will just appear, if the query of the report doesn't return any results and if you set the flag "WhenNoDataType" at reportLevel to "NoDataSection"... it does NOT mean, that a surpressed SubReport by a PrintWhenExpression  will render any of it's bands (it's just not executed at all)...

So either you don't use your PrintWhenExpression at the SubReport-Element and pass your dynamic User-Parameter down to the SubReport to add a flag to your SubQuery so that no data will result (e.g. " ... AND 1 = 2") or just add your PrintWhenExpression to each Subrepor-tBand except the NoDataSection.

so many ways leading to Rome.

hth

C-Box

Link to comment
Share on other sites

Thank you for the guidance, but the terms of this strange report are a different test I found. The function of this report is that it takes two inputs by the user form. The first value is the number of the invoice number that searches in the query and displays in the main report table, and the second value is in the string, which is attached to a two-option component of the form. This sends the component either the value of "sub1" or "sub2" and the section when print expression set to any sub report. However, the original report runs simultaneously with either its subreport or the second, but in any case, with no data clause added, and in the section when no data type, go to the no data section option if the bets are not executed. Band no data And the white page comes out. A funny point is that even if we delete both subreport and only the main report table, if the condition is still not true and the invoice number is not found, the data no part is executed. In the event that this report is performed, it is not possible for you to make solutions, because the structure of the report is not applicable for the purpose for which this report is not applicable. I will post the report files to attach yourself to the report and see the main problem. Thank you very much for your attention and guidance

 

 

Report file link:    My Report

 

 

Link to comment
Share on other sites

I can't see any where condition in your MAIN query??? So actually your Parameter "MainTraceCode" for filtering an invoice number is just evaluated for the SubDataSet!?!?!? 

So in my opinion all records from your "unfiltered" main query are used for rendering the main report. This should explain, why the NODATASECTION with your static text don't appear. (as probably many records are evaluated but not rendered - as you don't have any detail band) Just add the detail band and place some fields from master query,  to see whether my guess is right.

Not sure, why you doesn't use the parameter for the main-query also?

By the way comparing Strings via "==" isn't  good "java-like" ... better to use the equals methode:

$P{MainReportSwithch}.equals("sub2")   or even better  "sub2".equals($P{MainReportSwithch}) to avoid internal null-pointers.

hth + regards

C-Box

 

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