Jump to content

mvw

Members
  • Posts

    5
  • Joined

  • Last visited

 Content Type 

Forum

Downloads

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Events

Profiles

Posts posted by mvw

  1. Hi,

    Try setting "minHeightToStartNewPage" property in Scriptlet,

    Important:

    minHeight  <  (Page height) - (Header + Footer + external groups) height

    don't set "Start on a new page" property for the group

     

    Good luck!

     

    Code:
    public void beforeGroupInit(String groupName) throws JRScriptletException{    if (groupName.equals("myGroup")) {        JasperReport jr = (JasperReport) getParameterValue("JASPER_REPORT");        JRGroup grp = getGroup(jr, "myGroup");        Boolean isNewPage = {define_your_condition};        if (isNewPage) {            grp.setMinHeightToStartNewPage(450);        }        else {            grp.setMinHeightToStartNewPage(0);        }    }}public static JRGroup getGroup(JasperReport jr, String groupName) {    JRGroup group = null;    if (jr != null) {        JRGroup[] groups = jr.getGroups();        if (groups != null) {            for (int i = 0; i < groups.length; ++i) {                if (groups[i].getName().equals(groupName)) {                    group = groups[i];                    break;                }            }        }    }    return group;}
  2. Define a variable for count the first record of the group. Two options:

     

    1) Count value only for first record of the group

    Name: G2_NUMBER

    Variable Class:  java.lang.Integer

    Calculation: Count

    Reset type:  Report

    Increment type: None

    Variable Expression: ($V{G2_COUNT} != null && $V{G2_COUNT} == 1) ? "" : null

     

    2) Count value once time by group

    Name: G2_NUMBER

    Variable Class:  java.lang.Integer

    calculation: Count

    Reset type:  Report

    Increment type: Group

    Increment group: G2

    Variable Expression: $F{<field_name_not_null>}

     

×
×
  • Create New...