Jump to content
We've recently updated our Privacy Statement, available here ×

default expression value


fcramy

Recommended Posts

 My question could be posted in a different section but my first guess is that it goes in the IReport section and not the JasperReport section. If I'm wrong, I'll gladly take my question there.

My issue is this: i've created a Java application that takes, as input, an xml file with several parameters for the creation of a set of Jasper Reports. These parameters are fed into the query and a set of reports returns. I've found that the first time I run the batch application I get blank reports. In order to figure out why I get blank reports, I manually extract one set of parameters from the xml file and insert them into IReport as the default value expression for the report. If this report does not come back blank, I find that when I go to run the batch application, the reports that were previously blank are now populated with the data I originally expected.

What I've deduced is that the blank reports are being generated because some combination of the default value expressions with the parameters the applicatoin is getting from the xml file are not valid and, therefore, not returning any results.

If anyone has bumped into this issue or can give me some more information about the nature of default value expressions, I would greatly appreciate it. 

 

Let me know if it would help to see the jrxml files. I can attach those as well.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 4 weeks later...

 Thanks so much for replying! Sorry it took me so long to notice this, i was on to the next project.

The answer to your question is a little complicated because I've created a java application that produces the reports in bulk. So, the process goes like this, i run an SQL query that returns results from a database, i put those results into an xml file, i run that xml file through an xsl transfer which generates another xml file that can be read by the java app. the java ap then creates the paramter map with the code attached.

Code:

 

then this piece of code is called to fill the report:

 

Code:
public String fillJasperToJRPrintWithDB(String compiled,  Report r) throws net.sf.jasperreports.engine.JRException {		String jasperPrint = "";				try{			Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");			connection = DriverManager.getConnection(r.getInfo().getDBConnectionString());//"jdbc:sqlserver://fcreports:1433;user=fcdbuser;password=vB7zc31b0Ml;databaseName=firstCoverage");											if(ParseCmdLine.isVerbose()){				System.out.println("Filling report: " + compiled);			}					jasperPrint = r.getInfo().getFilledDirectory() + r.getReportName();			System.out.println("The .jasper filename will be: " + jasperPrint);						HashMap <String, Object> reportParams = new HashMap<String, Object>() ;			reportParams.putAll(r.getQuerySet()) ;			reportParams.put("SUBREPORT_DIR", r.getInfo().getSubreportsDirectory());			reportParams.put("IMAGE_DIR", r.getInfo().getImagesDirectory());						JasperFillManager.fillReportToFile(compiled + ".jasper",  jasperPrint + ".jrprint", reportParams, connection);			if(ParseCmdLine.isVerbose()){				System.out.println("Filled report to: " + jasperPrint + ".jrprint");			}						connection.close();		}

Post Edited by Ramy Abdel-Azim at 12/09/08 21:46
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...