alcoholic Posted May 27, 2009 Share Posted May 27, 2009 HiI have a main report which contains multiple subreports in its detail band. These subreports cause the main PDF output to be of multiple pages. I need to capture the current page number in the subreports. For this I passed a parameter(MAIN_PGNUM) to the subreport with its expression being $V{PAGE_NUMBER}. The problem that I am facing is, in the subreport the parameter MAIN_PGNUM always takes a value of 1, irrespective of the current page number from where the subreport is being called. I beleive the problem is with the evaluation time of the variable $V{PAGE_NUMBER} before it is being passed to the subreport. If I use a Text Field in detail band of Main Report, with expression (""+$V{PAGE_NUMBER}) and evaluation time as 'Now ', I get output as 1 on PDF. But if I use evaluation time as Page(or if I use the text field in header or footer Band), I get the correct page number as output. So, is there any way to change evaluation time of variable before it is being passed onto subreport? I know that if I use the subreport in the summary band, I can get the correct page number passed. But because of the layout and design for final output, I need to have the subreports in the detail band.P.S.:To give an insight, I need to create a TOC with page numbers. For this I was thinking about adding to a map, the key element and its corresponding actual Page number on the PDF. As the key elements are a part of subreports, I need to have the actual page number in subreport to be able to add it to the map. With this map, I would then generate TOC with page numbers. Any suggesstions about other approaches for creating TOC are welcome.Post Edited by alcoholic at 05/27/2009 15:00Post Edited by alcoholic at 05/27/2009 15:04 Link to comment Share on other sites More sharing options...
alcoholic Posted May 28, 2009 Author Share Posted May 28, 2009 any suggestion would be of great help. I am stuck. Link to comment Share on other sites More sharing options...
ukr Posted May 28, 2009 Share Posted May 28, 2009 Hi there,I tried to solve this for some time -no success; what i do now is, that i prepare the main report in a way, that i have the page numbers there and have the subreports without the page numbers (means header or footer only in main report).Sorry, if you find another solution, post it. Best regardsUli Link to comment Share on other sites More sharing options...
alcoholic Posted May 28, 2009 Author Share Posted May 28, 2009 Thanks for the reply uli.I wish that my problem was just displaying page numbers. :)I need the page numbers in the subreports, to be able to map key elements in the subreports with their actual page numbers. With this map, I wanted to generate the Table of Contents with page numbers and key elements.If you can suggest any other method for capturing page numbers in subreports, or for generation of the table of contents, it will really help me. I am not able to figure out any other way. Link to comment Share on other sites More sharing options...
alcoholic Posted June 4, 2009 Author Share Posted June 4, 2009 I've finally been able to work this out.I made two scriptlet classes- one for main report and one for sub reports. I made one bean class as a holder for the data.I declared a variable with the type as bean class and passed that as a parameter to the subreports. Then using the sciptlets i retieved the data and manipulated it, and was able to successfully generate the TOC :) Link to comment Share on other sites More sharing options...
silversoft Posted May 24, 2010 Share Posted May 24, 2010 alcoholicWrote: I've finally been able to work this out. I made two scriptlet classes- one for main report and one for sub reports. I made one bean class as a holder for the data. I declared a variable with the type as bean class and passed that as a parameter to the subreports. Then using the sciptlets i retieved the data and manipulated it, and was able to successfully generate the TOC :) Hi there, can you explain in more detail how to achieve this?As the variable isn't set when creating the TOC (on the first page), it will be set to 'null'. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now