JasperReports expression evaluation - jasper-reports

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.

Related

JasperReports: report parameter as an argument for message bundle lookup

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?

JasperReports Server: Input Controls error

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.

Error while deploying the report The Value expression for the textrun 'Textbox.Paragraphs[0].TextRuns[0]'

While I am trying to deploy the report it is giving the following error.
The Value expression for the textrun 'Textbox.Paragraphs[0].TextRuns[0]'
contains an aggregate function (or RunningValue or RowNumber functions)
in the argument to another aggregate function (or RunningValue).
Aggregate functions cannot be nested inside other aggregate functions.
But when I ran the report it is working fine. Only it is throwing error while deploying..
I used the following expression.
=IIF(Inscope("Group3")
,SUM(Fields!Prin_Bal.Value)
,SUM(IIF(Fields!Data_Dt.Value=Max(Fields!Data_Dt.Value)
,Fields!Prin_Bal.Value,0))
/SUM(IIF(Fields!Data_Dt.Value=
DateAdd("d",-1,DateAdd("q",1,DateSerial(Year(DateAdd("m",-3,Max(Fields!Data_Dt.Value)))
, (3*DatePart("q",DateAdd("m",-3,Max(Fields!Data_Dt.Value))))-2
, 1))),Fields!Prin_Bal.Value,0))-1)))
I used SUM in nested loop. When I run the report it works fine with the correct values. Only it is thorowing error while deploying. Is there anything to do with version?
Could you please help on this?
Appreciate all and any help.
Thanks,
Divya

iReports 4.5.1 throwing error while using TABLE Report Element

Hi I am getting the following error message while using the iReport designer Table Report Element:
Error filling print... java.lang.String cannot be cast to java.lang.Boolean
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
at net.sf.jasperreports.components.table.fill.FillTable.toPrintColumn(FillTable.java:116)
at net.sf.jasperreports.components.table.fill.FillTable$FillColumnEvaluator.visitColumn(FillTable.java:143)
at net.sf.jasperreports.components.table.fill.FillTable$FillColumnEvaluator.visitColumn(FillTable.java:130)
at net.sf.jasperreports.components.table.StandardColumn.visitColumn(StandardColumn.java:73)
at net.sf.jasperreports.components.table.fill.FillTable.evaluateColumns(FillTable.java:205)
at net.sf.jasperreports.components.table.fill.FillTable.evaluate(FillTable.java:98)
at net.sf.jasperreports.engine.fill.JRFillComponentElement.evaluate(JRFillComponentElement.java:88)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:257)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:473)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2021)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupHeader(JRVerticalFiller.java:616)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupHeaders(JRVerticalFiller.java:538)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:263)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:836)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:746)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)
at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:879)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)   
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
I am using Stored Procedures that returns a cursor as output.
I have placed this Table Report element in one of my group header.
thanks in advance
Meeza
Check in your style conditions if there's an evaluation with String. To ensure that everything works fine surround all the style conditions with new Boolean( ... ).

iReport: getting "Incompatible java.math.BigDecimal value assigned to parameter" exception

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.