JasperReports Continued on next page Grouping - jasper-reports

I have a jasperreport that prints debtors statements. I need to print 'Continued on the next page' in place of my existing group footer when there are more records than can fit on the first page.
I have created a second group footer which has the message and I want to print this when there is more to print, and the existing when it has finished.
Is there a way I can tell, at the end of the page, if there are more records in the group to print so I can build a "Print with Expression" expression?
With thanks
Mark

Ok this is the way I solved this.
I moved my subtotals for each client to the Page Footer and I added a text field with the words 'Continued...'.
In my group footer I placed a subreport component. I created a Boolean var called returnValue and passed it to and back from the subreport which set it false.
Using the print expression I only print the subtotal fields when returnValue is false and the 'Continue...' field when it tests null.

Related

Start JasperReport subreport on new page, but not when launched as main report

I have a JasperReport named 'Receipt' that can be launched as a:
subreport in a Summary band, to display any receipts
main report, to display a particular receipt
How can I start a new page before any receipts, when it is used as a subreport, but suppress the new page if there are no receipts?
Setting isTitleNewPage="true" works when it is used in the subreport case, but causes the Detail band to be displayed on the second page when it is used as a main report.
Using a Break prior to the subreport means a redundant page is used if there are no receipts.
I solved it by:
Adding a Boolean isSubReport parameter to the report
in the Detail band, adding a Break, with a Print When Expression set to:
$V{PAGE_NUMBER} == 1 && $P{isSubReport}
In the parent report, passing the parameter isSubReport with value TRUE()
Feels like there should be a cleaner solution, but it seems to work.

Jaspersoft - group Start New Page ignores print when expression

I have a group header which contains a title, a short description and then in the details band I print out the content.
I've set it up so that for each new group (grouped by title) it should start on a new page. Now I want to make sure that I don't print the title and the short description if I don't have any content related to it. So I've made a field which checks for a unique id in the content and use that field in the group band properties print when expression and in my details band print when expression.
And that works, I no longer print the title and short description if there is no content related to it. Here's the problem, with this setup I get a lot of empty pages inside my report where it originally printed the title and short description without content. If I remove the Start New Page option in my group I no longer get these empty pages. So somehow my group starts a new page before checking my print when expression, then checks it and decides not to print the groups content.
Have I've done something wrong or is there any way to bypass this behavior?
Instead of using the Start New Page setting in the group I used a break element with a Print When Expression, this does exactly what I thought the Start New Page option would do.

Printing the head line only on first page

I have jasper report which is created by many objects.
I want the header in one object. The object may come any where in the report.
How can i print header only on the first page of the object.
Can i use print when expression if page number equals 1.
is that page no means for whole pdf report or for only single jrxml object.
Thanks.
What does you mean anywhere in the report? If you want to print a title only once and in the first page, use the Title band in the jasper reports. No need of additional conditions required.

Subreports dependancy

Is there a way to show one subreport if the other subreport doesn't have any rows (doesn't return any rows).
What have I tried:
In my first subreport I returned the number of processed rows "REPORT_COUNT" to master report variable "SUBREPORT_VAR". Variable "SUBREPORT_VAR" works as it should. I added additional text field to master report and output variable to it. I set Evaluation time of text field to Band, as without this it doesn't work correctly.
Further I set option "Print When Expression" of the second subreport to:
$V{SUBBREPORT_VAR} < 1
I use jasper studio 5.5.0 final.
If there is no row count wouldn't the result be null.
If so you you could use this in the print when expression in your second subreport:
$V{SUBBREPORT_VAR}==null
another option is to run the query in your main report and use this as the subreport expression:
IF($F{SOME_VAR_FROM_YOUR_QUERY}==null,subreport2.jasper,subreport1.jasper
This prints subreport2 when your SOME_VAR_FROM_YOUR_QUERY returns null if not it prints subreport1.

How does one dynamically take values from a Group, add it to an Array, and then print individual values in the Page Footer?

I have a report file, where the report provides information on a "Job" - so this is a "Job Ticket" report. Inside the Job Ticket, there is a group with details that provides information on individual "Components" of which there can be anywhere from 1 Component to 6 Components in any given Job. There is a field applied to each component which is a string and is the "ComponentType" ({sp_JobTicket.ComponentType}).
What I would like to do is put the value of each row of ComponentType into an Array, which I can then call in the Page Footer (i.e., so I can create a Text Object and in it call a value using something like "TypeforComponent[3]"), so even though every printed page will only show the full details of one component, the page footer for each page will provide an at-a-glance view of all the components and their types.
As it is right now, we just hand write the component types for all components on the printed page itself, but we can access the ComponentType through the database, so it seems like we should be able to get it to print on the report.
Here is a full page preview of of a printed Job Ticket report that has 4 components (so in the Page Footer only 1-4 would have a value, 5-6 are empty), and where everything is currently laid out, and where we're hoping to get things placed:
Lots of questions but assuming this report is run for only 1 job ticket at a time here is one possibility:
Create formula called CT_Array and place in header1 section and suppress:
WhileReadingRecords;
stringvar array CT_Array ;
stringvar output := "";
numbervar i := ubound(CT_Array)+1;
redim preserve CT_Array[i];
CT_Array[i] := {sp_JobTicket.ComponentType};
Then create 6 formulas (CT_Var1 through CT_Var6) to read as follows:
WhileReadingRecords;
stringvar array CT_Array ;
CT_Array[1]
Replacing CT_Array[1] with the next array element number
Place those formulas where needed in page footer.
CT_Var2
WhileReadingRecords; stringvar array CT_Array ;
if ubound(CT_Array) >
1 then CT_Array[2] else ""
etc... for CT_Var3 through 6
So it looks like the simpler and more straight-forward solution to my problem was to not use an Array, but to create a Subreport.
I accomplished this by creating a new report, linked it to the stored procedure used by my Job Ticket (main) report, and imported the data fields I needed. I then proceeded to change the Page Size for the subreport to fit into the size on the page (1.5" x 1"), set the Details section to "Format with Multiple Columns" in the section expert which made available a new "Layout Tab" which I entered and selected "Format Groups with multiple column[s]." Then I saved that as a separate file and imported that report into my main report as a Subreport. Finally I set the Subreport Links to link to my "JobNumber" field which my main ticket uses as a parameter and that Field to the parameter.
Completed Successfully: