You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we have reports with a page footer containing the usual "page x of y" text which has traditionally been implemented using two textfields. Each of them contains $V{PAGE_NUMBER} with one textfield having evaluation time now and the other has evaluation time report or group (depending on the report).
Now we upgraded to Jasperreports 6.17.0 and thought that always managing two textfields is annoying since you can not nicely align them to the right (since you don't know the total number of pages and you have to reserve some unknown space to the right). So we used a different approach with a single textfield and evaluation time auto. I think this is the recommend way these days.
So we created two variables CURRENT_PAGE_NUMBER (reset type page) and TOTAL_PAGE_NUMBER (reset type report or group depending on report) and put them into a single textfield with evaluation time auto. Both variables have expression $V{PAGE_NUMBER}, no calculation function and no initial value.
This mostly works but some of our reports produced wrong page numbers. Basically for a given group the amount of total pages was missing one page and on that last page of the group the current page number is null.
I have attached an example jrxml + csv data file that reproduces the issue. The example contains both approaches described above so you can see the difference between both.
Extract attached zip file
Open file evaluation-time-auto-bug.jrxml in jasper studio
Create a CSV data adapter and use the file jasperreports_testdata.csv. Hit the button Get column names from the first row of the file and make sure to check skip the first line below in the other section. The wizard should detect 5 column names (two groups with id + data columns and a detail_data column)
Now open the preview of the report and choose the created CSV data adapter to populate the preview.
You should now see 6 pages and the page numbers of the last two pages shown in the evaluation time auto textfield are wrong. The page numbers basically miss the last page:
auto approach: Page 1 of 1 => Page null of 1
traditional approach: Page 1 of 2 => Page 2 of 2
I think the reason is that the second detail band is moved to a new page but the underlying model is not fully updated so that $V{PAGE_NUMBER} has a wrong value.
In our real reports this issue does not only happen on the very last pages of the last group of the report but can happen on any group within the report. Basically whenever detail bands of the last page within a group have to be moved to a new page.
The text was updated successfully, but these errors were encountered:
The recommended approach to "Page X of Y" is to use $V{MASTER_CURRENT_PAGE} for X with evaluationTime set to "Master" and ${MASTER_TOTAL_PAGES} for Y also with evaluation time set to 'Master'.
Hi,
we have reports with a page footer containing the usual "page x of y" text which has traditionally been implemented using two textfields. Each of them contains
$V{PAGE_NUMBER}
with one textfield having evaluation timenow
and the other has evaluation timereport
orgroup
(depending on the report).Now we upgraded to Jasperreports 6.17.0 and thought that always managing two textfields is annoying since you can not nicely align them to the right (since you don't know the total number of pages and you have to reserve some unknown space to the right). So we used a different approach with a single textfield and evaluation time
auto
. I think this is the recommend way these days.So we created two variables
CURRENT_PAGE_NUMBER
(reset typepage
) andTOTAL_PAGE_NUMBER
(reset typereport
orgroup
depending on report) and put them into a single textfield with evaluation timeauto
. Both variables have expression$V{PAGE_NUMBER}
, no calculation function and no initial value.This mostly works but some of our reports produced wrong page numbers. Basically for a given group the amount of total pages was missing one page and on that last page of the group the current page number is null.
Reproduction example
evaluation-time-auto-bug.zip
I have attached an example jrxml + csv data file that reproduces the issue. The example contains both approaches described above so you can see the difference between both.
evaluation-time-auto-bug.jrxml
in jasper studiojasperreports_testdata.csv
. Hit the buttonGet column names from the first row of the file
and make sure to checkskip the first line
below in theother
section. The wizard should detect 5 column names (two groups with id + data columns and a detail_data column)You should now see 6 pages and the page numbers of the last two pages shown in the evaluation time
auto
textfield are wrong. The page numbers basically miss the last page:auto
approach: Page 1 of 1 => Page null of 1I think the reason is that the second detail band is moved to a new page but the underlying model is not fully updated so that
$V{PAGE_NUMBER}
has a wrong value.In our real reports this issue does not only happen on the very last pages of the last group of the report but can happen on any group within the report. Basically whenever detail bands of the last page within a group have to be moved to a new page.
The text was updated successfully, but these errors were encountered: