2004 IR Help Posted August 21, 2006 Share Posted August 21, 2006 By: EMI - emi_1973 Variable and total number of details 2005-05-09 06:41 Hi all, does anyone have an idea how to get the total number of ALL details as variable? (not only of the current page) Principle I'm looking for same functionality as this: <textField evaluationTime="Report" isStretchWithOverflow="true"> <reportElement x="0" y="0" width="80" height="15"/> <textElement textAlignment="Left"> <font reportFont="Header_Normal"/> </textElement> <textFieldExpression class="java.lang.String"> String.valueOf($V{REPORT_COUNT}) </textFieldExpression> </textField> But I need this information as variable for further analysis. I've read the jasper documentation and tested arround with different attributes but couldn't finde the solution Any idea? I would be grateful for assistance... Thanks, Best Regards, Marco By: Teodor Danciu - teodord RE: Variable and total number of details 2005-05-09 06:59 Hi, The predefined REPORT_COUNT variable is the one you need. The only problem I see with it being used for further analysis is that this variable gets incremented during the report filling process and the corrent value is reached only when the end of the document is reached. So using this variable inside some other expression during the report filling process might not be relevant. If you need to know before hand how many records there will be in the report, you have to obtain that information before actually calling JasperReports by executing an SELECT COUNT(*) or something equivalent. I hope this helps. Teodor By: EMI - emi_1973 RE: Variable and total number of details 2005-05-10 00:45 Hi Teodor, thanks for information .... hmm... seems I have to find another possibility to solve my problem. Perhaps I will choose the suggested select statement ... Here some background for my problem, perhaps you have another idea? I'm using a dummy group as summary, like described at http://jasperreports.sourceforge.net/ in "Tips and Tricks" section. The reason is, that I have a really big summary an often a page break will be generated inside of summary, because of to much details. If I would use the normal summary section, the pageHeader is missing at the next site and pageFooter too. (=unacceptable) This described summary section behavior is normally, see "Tips and Tricks section" But where is my problem? The problem is, that the columnHeader will appear at the second page too, but rest place at first page will be used for printing details (resp. data in details section) So only the summary text appear at second page (as desired) but the columnHeader too ( :-( ) Fazit: My idea is to suppress columnHeader with printWhenExpression, in case that no details will be print at second page. My idea: I detect the number of ALL details and the printed details at page before. The difference between this values, can be used as criterium for my printWhenExpression, resp. will be the criterium when to suppress the columnHeader. No more details to print: No columnHeader ;-) This would be a general solution for 1 to x pages .. But perhaps I'm completely wrong and there is much more easier way? Thanks, Marco 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