tmg Posted February 23, 2007 Share Posted February 23, 2007 We are trying to get column headings for certain export types to show only on the first page. When executing the code below, we get the following error:net.sf.jasperreports.engine.JRException: Report design not valid : 1. Variable not found : $V{PAGE_NUMBER} Code: JRDesignBand bandDetail = new JRDesignBand(); bandDetail.setHeight(20); JRDesignBand bandHeader = new JRDesignBand(); bandHeader.setHeight(60); //suppress column headings except for the following export types if (mExportType != "PDF"«») { JRDesignExpression mExp = new JRDesignExpression(); JRDesignExpressionChunk c1 = new JRDesignExpressionChunk(); c1.setText("new Boolean("«»); c1.setType(JRExpressionChunk.TYPE_TEXT); mExp.addChunk(c1); JRDesignExpressionChunk c2 = new JRDesignExpressionChunk(); c2.setText("$V{PAGE_NUMBER}"«»); c2.setType(JRExpressionChunk.TYPE_VARIABLE); mExp.addChunk(c2); JRDesignExpressionChunk c3 = new JRDesignExpressionChunk(); c3.setText(".intValue()==1)"«»); c3.setType(JRExpressionChunk.TYPE_TEXT); mExp.addChunk(c3); mExp.setValueClass(Boolean.class); bandHeader.setPrintWhenExpression(mExp); } Any help would be greatly appreciated. Link to comment Share on other sites More sharing options...
lucianc Posted February 23, 2007 Share Posted February 23, 2007 The variable expression chunk text should only contain the variable name:Code:c2.setText("PAGE_NUMBER"«»); c2.setType(JRExpressionChunk.TYPE_VARIABLE); HTH,Lucian Link to comment Share on other sites More sharing options...
tmg Posted February 24, 2007 Author Share Posted February 24, 2007 Thanks so much Lucian,It worked!! 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