roby1483 Posted July 24, 2008 Share Posted July 24, 2008 Hi to all, I have declared one variable in my subreport like this:<variable name="ELEMENT_COUNT" class="java.lang.Integer" resetType="Report" calculation="Nothing"> <initialValueExpression><![CDATA[new Integer(0)]]></initialValueExpression></variable>and I have created one scriptlet that increment this variable for each evaluated element: @Overridepublic void beforeDetailEval() throws JRScriptletException { Integer i = (Integer) getVariableValue("ELEMENT_COUNT"); if (i != null) { int num = i.intValue(); num++; setVariableValue("ELEMENT_COUNT", new Integer(num)); } else System.out.println("******* ELEMENT_COUNT not found ********");}I use this variable for print one line when the value is !=1 (for the first element the line will not be printed).At the first execution all worked well but now (from yesterday afternoon) the scriptlet don't find the variable.Can some one help me please?Thanks at all. Link to comment Share on other sites More sharing options...
roby1483 Posted July 25, 2008 Author Share Posted July 25, 2008 Hi to all, anyone can help me? I have noticed that if I set the reset type as Report, the first execution of beforeDetailEval() find the variable but the subsequent execution not find it. If I set reset type as Nothing all execution of beforeDetailEval() not find the variable. Link to comment Share on other sites More sharing options...
roby1483 Posted July 25, 2008 Author Share Posted July 25, 2008 I have resolv without scriptlet and with this variable declaration:<variable name="NUM_ELEM" class="java.lang.Integer" resetType="Report" calculation="Nothing"> <variableExpression><![CDATA[new Integer($V{NUM_ELEM}.intValue() + 1)]]></variableExpression> <initialValueExpression><![CDATA[new Integer(0)]]></initialValueExpression></variable> 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