indirabal Posted October 12, 2011 Share Posted October 12, 2011 I have to implement OMR logic in my report, for this i need to compare current page==total number of pages in the group. how to get total number of pages.ExampleII - First symbol for starting page, next one for last page,new Boolean($V{PAGE_NUMBER}.==$V{total_pages} - > this will set the flag. whenever i am reaching the last page the flag will disable else enable.Please revert back any body having ideas. Link to comment Share on other sites More sharing options...
lknueve Posted October 12, 2011 Share Posted October 12, 2011 you'll need to add a variable - the variable should be set to Integer class, reset type is Report, and increment by 1 for each page. can do this by several means - example I use is setting Initial expression to 1, and then Variable expression to $V{varname}++ (assuming your report language is Groovy. Then when you're putting the variable on the report, make sure the text field as the evaluation time set to Report as well. Link to comment Share on other sites More sharing options...
indirabal Posted October 13, 2011 Author Share Posted October 13, 2011 I am using subreport also. how to create global variable.(I have tried this logic second page onwards i am getting null value(because second page onwards i am using subreport's))As you mentioned , the text box evaluation time = report, but i am going to use my variable on the line. there is no evaluation time proper ty. $V{total_page}++ ------------------> its giving run time error(evaluateEstimated signature: (I)Ljava/lang/Object;) Inconsistent stack height 1 != 0 null)ex:I am going to use my variable on Line(|), there is noprint when expression=new Boolean($V{PAGE_NUMBER})==$V{total_pages}) - > it will set trur/falseMy aassumtions:IIIIIII ---------> like this i am having the lines in the corners of the report, i have to disable the second line whenenver reaching the last page of group. so that my machine (OMR) will understand the last page based on this(machine will cut the papersonce reaching last page). that 's y i framed the below condition.But i am not getting the total number of pages in the group.print when expression=new Boolean(!$V{PAGE_NUMBER})==$V{total_pages}) . Plz give some ideas to achive this. Post Edited by indirabal at 10/13/2011 05:05Post Edited by indirabal at 10/13/2011 05:16 Link to comment Share on other sites More sharing options...
lknueve Posted October 13, 2011 Share Posted October 13, 2011 can you post your jrxml? Link to comment Share on other sites More sharing options...
indirabal Posted October 14, 2011 Author Share Posted October 14, 2011 thanks for your immediate replyIn my report having more than 10 jrxml files.I got sub report also. I could not provide you the jrxml file. please look the below detailsIIIIII IIIIII ContentIIIIII IIIIII (i am using line's for this implementation)In my report i am having the lines in the corners(left,right(top,bottom))Requirment is whenever the last page is reaching the second line has to be disabled. Actualy this is for automation. My machine will read the lines and understand the position of the page. If the second line is disabled , machine will understand this is last page. It will cut the paper for furthure processing.., like that it has to do for more than one customers.....This is bulk report, at a time it will generate for more than one customers.In my earlier post i have excplained this is for OMR implementationCurrenly i am checking like this.print when expression=new Boolean(!$V{PAGE_NUMBER})==$V{total_pages}) Please update ASAP. Post Edited by indirabal at 10/14/2011 04:39 Link to comment Share on other sites More sharing options...
indirabal Posted October 18, 2011 Author Share Posted October 18, 2011 indirabalWrote: thanks for your immediate reply In my report having more than 10 jrxml files. I got sub report also. I could not provide you the jrxml file. please look the below details IIIIII IIIIII Content IIIIII IIIIII (i am using line's for this implementation) In my report i am having the lines in the corners(left,right(top,bottom)) Requirment is whenever the last page is reaching the second line has to be disabled. Actualy this is for automation. My machine will read the lines and understand the position of the page. If the second line is disabled , machine will understand this is last page. It will cut the paper for furthure processing.., like that it has to do for more than one customers..... This is bulk report, at a time it will generate for more than one customers. In my earlier post i have excplained this is for OMR implementation Currenly i am checking like this. print when expression=new Boolean(!$V{PAGE_NUMBER})==$V{total_pages}) Please update ASAP. Post Edited by indirabal at 10/14/2011 04:39 Code:hi,Any update on this? Link to comment Share on other sites More sharing options...
AWieclawski Posted January 19, 2020 Share Posted January 19, 2020 it could count one single page doc as two pages... but put below the last field initiation </field> <variable name="TOTAL_PAGE_NUMBER" class="java.lang.Integer" resetType="None" incrementType="Page"> <variableExpression><![CDATA[$V{PAGE_NUMBER}==null?$V{PAGE_NUMBER}:$V{PAGE_NUMBER}+1]]></variableExpression> </variable>and in the pageFooter section for ex. <pageFooter> <band height=".." splitType="..."> <property name="com.jaspersoft.studio.unit.height" value="px"/> <reportElement x=".." y=".." width="..." height=".." uuid="..."> <property name="local_mesure_unitheight" value="pixel"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> <property name="com.jaspersoft.studio.unit.y" value="px"/> </reportElement> <textElement textAlignment="..." verticalAlignment="..."> <font size="..." isBold="..."/> </textElement> <textFieldExpression><![CDATA[" Page " +$V{PAGE_NUMBER} + " / " +$V{TOTAL_PAGE_NUMBER} + " | powered by ..."]]></textFieldExpression> </textField> </pageFooter> I genarally suggest to use "Master" buil-in-system variables as follows:<textField evaluationTime="Master"> <textElement textAlignment="Right"/> <textFieldExpression><![CDATA[msg("Page {0} of {1}", $V{MASTER_CURRENT_PAGE}, $V{MASTER_TOTAL_PAGES})]]></textFieldExpression></textField>but vailable for JasperReports versions 6+ 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