quacker.2715 Posted May 31, 2017 Share Posted May 31, 2017 In a report where group keep together option is on, page count does not always start as 1 on a new page. It seems the event is:calculate page countprint page observing keep together, if overflow print to next page, but it does not recalculate the page countHere is a sample report, note on page 3 the page count is out of sync. How can I detect if the row is the first one on the page? <?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 5.6.1.final using JasperReports Library version 5.6.1 --><!-- 2017-06-01T08:50:29 --><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="PageCount" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d8c19cca-a276-411e-aa70-cf6409ab99bb"><property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/><queryString language="SQL"><![CDATA[select *from (values('A','1','Description Grp:A-1'),('A','1','Description Grp:A-2'),('A','1','Description Grp:A-3'),('A','1','Description Grp:A-4'),('A','1','Description Grp:A-5'),('A','1','Description Grp:A-6'),('A','1','Description Grp:A-7'),('A','1','Description Grp:A-8'),('A','1','Description Grp:A-9'),('A','2','Description Grp:A-10'),('A','2','Description Grp:A-11'),('A','2','Description Grp:A-12'),('A','2','Description Grp:A-13'),('A','2','Description Grp:A-14'),('A','2','Description Grp:A-15'),('A','2','Description Grp:A-16'),('A','2','Description Grp:A-17'),('A','2','Description Grp:A-18'),('A','2','Description Grp:A-19'),('A','2','Description Grp:A-20'),('A','2','Description Grp:A-21'),('B','3','Description Grp:B-1'),('B','3','Description Grp:B-2'),('B','3','Description Grp:B-3'),('B','3','Description Grp:B-4'),('B','3','Description Grp:B-5'),('B','3','Description Grp:B-6'),('B','3','Description Grp:B-7'),('B','3','Description Grp:B-8'),('B','3','Description Grp:B-9'),('B','3','Description Grp:B-10'),('B','4','Description Grp:B-11'),('B','4','Description Grp:B-12'),('B','4','Description Grp:B-13'),('B','4','Description Grp:B-14'),('B','4','Description Grp:B-15'),('B','4','Description Grp:B-16'),('B','4','Description Grp:B-17')) as a (col1,col2,col3)]]></queryString><field name="COL1" class="java.lang.String"/><field name="COL2" class="java.lang.String"/><field name="COL3" class="java.lang.String"/><group name="grpCol1" isReprintHeaderOnEachPage="true" keepTogether="true"><groupExpression><![CDATA[$F{COL1}]]></groupExpression><groupHeader><band height="19"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/><textField><reportElement x="0" y="0" width="360" height="14" uuid="e226b658-5b82-4d00-b9e3-7fc25e25b511"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/></reportElement><textFieldExpression><![CDATA[$F{COL1}]]></textFieldExpression></textField></band></groupHeader></group><group name="grpCol2" isReprintHeaderOnEachPage="true" keepTogether="true"><groupExpression><![CDATA[$F{COL2}]]></groupExpression><groupHeader><band height="19"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/><textField><reportElement x="10" y="0" width="240" height="14" uuid="0ec67ee7-7ca0-4c93-9f63-806e56768d2b"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/></reportElement><textFieldExpression><![CDATA[$F{COL2}]]></textFieldExpression></textField></band></groupHeader></group><pageHeader><band height="35" splitType="Stretch"/></pageHeader><columnHeader><band height="19" splitType="Stretch"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/><staticText><reportElement x="380" y="0" width="100" height="13" uuid="9fc501f9-78f6-4673-87ca-a00276f25377"><property name="com.jaspersoft.studio.unit.y" value="px"/></reportElement><text><![CDATA[Group Count 1]]></text></staticText><staticText><reportElement x="480" y="0" width="100" height="13" uuid="c1a8dca0-ddc8-4cb2-a5d1-8b4ad520b67c"><property name="com.jaspersoft.studio.unit.y" value="px"/><property name="local_mesure_unity" value="pixel"/></reportElement><text><![CDATA[Group Count 2]]></text></staticText><staticText><reportElement x="580" y="1" width="100" height="13" uuid="5f613aaf-4f3b-4be3-93c6-014187e57f15"><property name="local_mesure_unity" value="pixel"/><property name="com.jaspersoft.studio.unit.y" value="px"/></reportElement><text><![CDATA[Page Count]]></text></staticText></band></columnHeader><detail><band height="20" splitType="Stretch"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/><textField><reportElement x="10" y="0" width="360" height="13" uuid="b0418a70-7176-450a-b25b-90ee665c72d7"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/></reportElement><textFieldExpression><![CDATA[$F{COL3}]]></textFieldExpression></textField><textField><reportElement x="380" y="0" width="100" height="13" uuid="2d7357ee-4de1-4d66-8d0c-ff67647b3477"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/></reportElement><textFieldExpression><![CDATA[$V{grpCol1_COUNT}]]></textFieldExpression></textField><textField><reportElement x="480" y="0" width="100" height="13" uuid="2842ef4b-3bed-403c-b00d-836060541013"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/></reportElement><textFieldExpression><![CDATA[$V{grpCol2_COUNT}]]></textFieldExpression></textField><textField><reportElement x="580" y="1" width="100" height="13" uuid="6369eec8-4f0f-4b3d-a558-1cb83681711c"/><textFieldExpression><![CDATA[$V{PAGE_COUNT}]]></textFieldExpression></textField></band></detail><pageFooter><band height="54" splitType="Stretch"/></pageFooter></jasperReport> Link to comment Share on other sites More sharing options...
lwm0227_1 Posted June 9, 2017 Share Posted June 9, 2017 If you know the max line per page then you may add new variable to control it. Then use the created variable as you page number. 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