My question relates to an error when generating a report.
In JasperReports Server created a Single Input Control Value but when you try to generate a report I get the error:
The server has encountered an error. Please excuse the inconvenience.
Error Message
net.sf.jasperreports.engine.JRRuntimeException: Invalid type java.lang.String for parameter SelectAsset used in an IN clause; the value must be an array or a collection.
In the preview iReport everything works flawlessly. I will put the value and generates a report.
if you mean a single value by "Single Input Control Value" it should not be a collection. So
Change your SelectAsset parameter type from java.util.Collection to java.lang.String
Then redeploy your report to the server then try again.
Related
While using Crystal Reports I have encountered a strange bug, that repeats itself already with a number of my reports.
I still didn't fully get how I replicate it, but usually it goes as follows:
I add a parameter of any type to an existing report document, however it doesn't appear in a parameter prompt at all.
After I change parameter order in the Parameter Fields Section, my Parameter disappears and instead I see a duplicate of another parameter in a parameter list, and in the "Set Parameter Order"-Window I see this duplicated parameter as [ParameterName, ParameterName]. If I save the document in this moment and try to reopen it, CR crushes.
If I try to load this document in Vstudio with CREngine, the code exits with the message "Access violation".
Here is a pic of what is happening:
The reason you are not being prompted for the new "test" parameter is that it is not used by the report for anything.
The rest of the behavior is indeed strange. Consider removing the '#' character from the name of the first parameter to see if that fixes it.
If some of those parameters are from a stored procedure, perhaps your report is simply out of sync with the data source. Do Database, Verify Database...
How to look up a particular internationalized property based on a report parameter?
This works, but is static:
$R{some_literal_string}
This works too, but is not internationalized:
$P{key_to_parameters_map_element}
What I need is:
$R{$P{key_to_parameters_map_element}}
Unfortunately, I get a pile of error messages:
Caused by: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. Syntax error on token "}", delete this token
value = str("$P{key_to_parameters_map_element")}; //$JR_EXPR_ID=13$
This doesn't change anything:
$R{$P{key_to_parameters_map_element}.toString()}
Is this possible at all?
It's
str($P{key_to_parameters_map_element})
Quite intuitive, isn't it?
I try to use a report on my JasperServer, which I created with the help of iReport. In iReport my report works fine and there are no errors. But when I tried to deploy the report it gives me following error in short:
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
and the complete Error:
The server has encountered an error. Please excuse the inconvenience.
Error Message
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
Error Trace
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.setDate(JRJdbcQueryExecuter.java:649)
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.setStatementParameter(JRJdbcQueryExecuter.java:577)
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.setStatementParameter(JRJdbcQueryExecuter.java:399)
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter$1.visit(JRJdbcQueryExecuter.java:332)
at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter$QueryParameter.accept(JRAbstractQueryExecuter.java:157)
at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.visitQueryParameters(JRAbstractQueryExecuter.java:646)
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createStatement(JRJdbcQueryExecuter.java:317)
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:196)
at com.jaspersoft.jasperserver.api.engine.jasperreports.util.JRTimezoneJdbcQueryExecuter.createDatasource(JRTimezoneJdbcQueryExecuter.java:168)
at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1087)
at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:668)
at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1258)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:877)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFiller.run(BaseFillHandle.java:120)
at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$SynchronousExecutor.execute(EngineServiceImpl.java:875)
at net.sf.jasperreports.engine.fill.BaseFillHandle.startFill(BaseFillHandle.java:165)
at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$AsynchronousReportFiller.fillReport(EngineServiceImpl.java:831)
at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.fillReport(EngineServiceImpl.java:1658)
at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportFill.runReport(EngineServiceImpl.java:1022)
at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportRunnable.run(EngineServiceImpl.java:897)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
I uploaded the report, got the right data source (I tested it with another report already) and imported my Resources (Subreports) and input controls. I don't know whether I missed a step or so, but I am pretty sure that I did everything required. Importing every Subreport, setting input controls declare the right path repo:mySubreports.jrxml. If you need more information please tell me ! I think I added all information required and I don't want to spam SO with useless information because I don't know which information could be useful by now as well :)
I think this has something to do with date parameters/variables in your report.
Please ensure the input control you made for the date parameters in Jasperserver are java.util.date
Also one common error i have seen myself repeating is putting a default value expresion like an empty string may be ("") for the date parameters/variables where they are declared .In this case i have seen the report works in ireport also gets upload in the server without any error but it would throw
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date Error Trace
Please check the above two points with all the date parameters of your report and update here if that works
Thanks
chandra
Hi, I am using jasper reports 5.0.0.
the following code in jrxml throws exception
new java.text.DecimalFormat("#,###").format($P(xyz))
throws an expression evaluation exception.
Where as I change this to
new java.text.DecimalFormat("#,###").format(Double.valueOf($P(xyz))),
the exception is gone.
Why?? Any help is appreciated,
Thanks
In report Parameter Value expression of the Input parameter must be different than Input control value which you are passing through input control.
I am developing report containing sub report using iReport and i am passing two external parameters in master report: the CurrWeek and CurrYear parameters. I'm passing the same parameters to the subreport.
In both reports I declared parameters as BigDecimal. When i run the report it shows the error shown bellow:
Error filling print...
net.sf.jasperreports.engine.JRException:
Incompatible java.math.BigDecimal value assigned to parameter
CurrWeek in the WeeklyReportForOtherWeek dataset.
net.sf.jasperreports.engine.JRRuntimeException:
net.sf.jasperreports.engine.JRException:
Incompatible java.math.BigDecimal value assigned to parameter
CurrWeek in the WeeklyReportForOtherWeek dataset.
This error mean that you pass wrong type from dataset to parameter.
Look at the place where you are creating (filling) dataset.