Jump to content
Changes to the Jaspersoft community edition download ×

Issues passing Variable from Sub Report to Main Report


Recommended Posts



I am trying to send a variable from a sub report to the main report, and then use the variable in a print when expression to eliminate blank space.

The variable is set up exactly the same on master and sub reports name=

v_return, class = java.lang.String, calculation = no calculation function,  expression = blank, Initial value expression = blank,  increment type = none, incrementer factory class name = blank, reset type = none

In my print when expression - new Boolean($V{v_return}!= null)

When I run the report, I get the following Error - net.sf.jasperreports.engine.JRRuntimeException: Increment class  not found.


Any idea's?  I have been searching all day to find a solution, but nothing has helped.

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic


When you say 

incrementer factory class name = blank,

 I assume you mean it is blank in the Jasper studio.

Check in the source of the report is there an empty string.

EG somthing like this:

<returnValue incrementerFactoryClass=""/>

If there is delete the entire  incrementerFactoryClass=""  element

Also check that the value you are assigning back is a system not no calculation function.

calculation =  System

Link to comment
Share on other sites

So - I was finally able to get the report to compile and run, however... The variable on the main report is returning null every time, therefore my band will not print..

Code from main report : 

<variable name="v_return" class="java.lang.String" resetType="None" calculation="System"/>

<printWhenExpression><![CDATA[new Boolean($V{v_return}!= null)]]></printWhenExpression>

<returnValue subreportVariable="v_return" toVariable="v_return" calculation="System"/>

Sub Report :

<variable name="v_return" class="java.lang.String" resetType="None" calculation="System">


Link to comment
Share on other sites

Yes to both:

Sub report band is called, and variable is actually in the band to show the value pulled. 

Main report pulls a separate query, sends a parameter to be used as a criteria in the sub report. Sub report sends variable back and prints the main report band based on whether or not the variable is null.


Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...