2004 IR Help Posted August 21, 2006 Share Posted August 21, 2006 By: msakbar - msakbar return data from a report after filling ? 2005-04-25 13:16 Is it possible for the jasper filling engine to return some data from the report after it is filled? For example, the report would sum a column, print it on the report, but also return that sum back to the calling app. I know that subreports can pass data back to the master report, but can the master report pass back data to the calling app? I searched the documentation/forums but couldn't find any clues... if anybody has tips or pointers, they would be much appreciated. Thanks, Salman By: C-Box - c-box RE: return data from a report after filling ? 2005-04-25 13:29 Well I would try to parse the JRPrint-Object for the element and try to get the value from the needed element. (of course you should give these elements a key that is not just "element-567" but better "sumfieldPrices" or anything like that.) if that is not possible you also can store the JasperPrint-Object to a JRPXML-Stream and parse that... there all elements are inside and should also be accessible from your calling app. Or another try would be to use a Scriplet that passes your needed data to the calling app via one of the latest scriplet-methods (just guess: afterSummary or something like this)... from a scriplet you have also full access to all variables and can call other public methods to transfer report data from JasperReport fillProcess outside to your main app. just my thoughts perhaps you can use something hth C-Box By: msakbar - msakbar RE: return data from a report after filling ? 2005-04-26 06:45 Thanks C-Box - I used the scriptlet approach and it worked great. A followup on scriptlets - so do scriptlet classes have to be static classes? as in the methods have to be static? because in the XML file you can only specify a class, not pass an instance of a scriptlet class. Am I correct in thinking this? Thanks... By: Keenan Brock - kbrock RE: return data from a report after filling ? 2005-04-26 10:55 http://jasperreports.sourceforge.net/tips.tricks.html#returnvalues mentions using a map to return data from a sub report to a main report. It looks like this could potentially work the same for the main report and the calling application. By: msakbar - msakbar RE: return data from a report after filling ? 2005-04-27 13:13 yes, that approach worked too and is cleaner than using scriptlets. By: C-Box - c-box RE: return data from a report after filling ? 2005-04-28 00:16 I don't think that this is cleaner because you have to "abuse" some printwhenexpressions to put the values into the parametermap... so IMHO the scriptlet-method is "cleaner" -- but that is just my opinion. C-Box 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