2001 JI Open Discussion Posted August 29, 2006 Share Posted August 29, 2006 By: Gestalt Solution - gestaltsolution Getting total #pages back to the program 2003-07-02 19:25Is there any way for the program to get the total number of pages printed when it generates a report? I need to store these statistics in a database for every report run. Thanks. By: Giulio Toffoli - gt78 RE: Getting total #pages back to the program 2003-07-03 01:15 You can with a trick. Add to your parameters map passed to the fill method of jasper an Hashmap like this... ... HashMap mymap = new HashMap(); parameters.put("MyHashMap",mymap); .... Add in your report a parameter of type Object to recive this parameter (and name it MyHashMap). Then create a variable of type Object with an expression like: ((java.util.HashMap)$P{MyHashMap}).put("MyReturnVal", $V{PAGE_NUMBER}) and resetType = "Report". In this way, during report filling, jasperreports will put the number or report printed in you hashmap. When the report is produced, you can retrive the number of page printed looking the value of... (Integer)mymap.get("MyReturnVal"); Enjoy. Giulio Link to comment Share on other sites More sharing options...
andylauies Posted September 19, 2011 Share Posted September 19, 2011 this method didn't work, the value returned is always "1" ! 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