Why is iReport throwing me these subreport exceptions? - jasper-reports

I am new to iReport and all I have done so far is simply run an already compiled report. In fact it's a report that we are currently using so there should not be any issue. Though, when ever I run the report I get thrown this error message
 Compiling to file... C:\Program Files\Fishbowl\reports\Custom\PackingListTacticalMedical2015.jasper
 Compiling subreports....
 Subreport C:\Program Files\Fishbowl\reports\Custom\SOPackingListTacticalMedical2015.jrxml already compiled.
 **Unable to locate the subreport with expression: "$P{cbLayoutFormat}.equals("standard") ? $P{path} + "POPackingList.jasper" : $P{cbLayoutFormat}.equals("carton") ? $P{path} + "cartonPOPackingList.jasper" : $P{path} + "POPackingListLoc.jasper"".**
Compilation running time: 13,619
The report does still run and compile but when ever I am prompted to "Enter a shipID" - and I do- the results are blank. I know what the message is saying, I just simply do not understand what it means.
Thanks to anyone that can help with instructions or explanations on this.

Try to change expression datatype of your subreports to InputStream instead of String (path), and then passe your subreport as input stream as a parameter.
Put your subreport in the resources dir. and compile it.
InputStream subReportStream=getClass().getResourceAsStream("subReportName.jasper");
params.put("SUBREPORT_STREAM", subReportStream);
this work fine for me.

With the way Fishbowl inserts it's run path into the $P{path} parameter you need turn off the compile subreports option when compiling and making changes to the the report. Also with the manner in which Fishbowl overrides the parameters at runtime you'd have to know all of the database ID's you're looking for if you want to run it from within iReport instead of inside Fishbowl.
The easiest work around for this is to have the reports compile to the their working directory and you can refresh inside Fishbowl as you compile changes to the reports.

Related

Why do I get current expression is not valid using JRDataSource?

I am trying to use List into the jasper report using JasperSoft Studio, but while defining dataset the JRDataSource expression is showing as invalid even after casting REPORT_DATA_SOURCE to the JRXmlDataSource(find image below).
Expression
((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/Header/FileName")
Error
The current expression is not valid. Please verify it!
The error is looking so weird and I am not able understand it what is wrong here.
Do not worry about it, this is a bug in the IDE.
If you can't close the expression editor, edit the expression manually in the xml view.

error in jasperserver :Resource interpreted as Script but transferred with MIME

I know this may be duplicate question.
I have this error when I start my community jasperserver, and load a report has custom visualization component , and this error occur.
disappear. when I call:
http://localhost:8080/jasperserver/reportresource/reportresource?resource=com/jaspersoft/jasperreports/customvisualization/resources/require/cv-component.js
nothing returns, so this may be the problem right ?
but when I start the jasperserver commercial version , this error disappear. when I call:
http://localhost:8080/jasperserver-pro/reportresource/reportresource?resource=com/jaspersoft/jasperreports/customvisualization/resources/require/cv-component.js
it returns the content of this cv-component.js.
any idea ?
the trick (which wored for me after hours of triel-and-error) is to set the proper configuration in jasperreports.properties (on an windows machine):
com.jaspersoft.jasperreports.components.customvisualization.require.js=file:/C:/path/to/require.js
net.sf.jasperreports.web.resource.pattern.customvisualization.scripts=com/jaspersoft/jasperreports/customvisualization/resources/require/.*
See the "file:/...." and "...require/.* specially... (a bit different than in teh jaspersoft docs...)
Cheers, Thomas

Jasper Reports Logic Conditions not executing from Netbeans: "Function IF not found" error

I'm using Jaspersoft Studio to design my reports and then executing them from Netbeans.
I have a subreport that passes a return value to the main report and that gets added to a value in the main report to make the grand total amount.
In the main report I populate a text field with the 2 values and in the text fields Expression I add them together to make the grand total.
Variable from Main Report - $V{SubTotal2}
Variable from Sub report - $V{SubTotal1}
The problem I'm having is this...
When I write the expression as $V{SubTotal1} + $V{SubTotal2} it works succesfully when executing the report in Netbeans.
But, I need to check if Subtotal2 is not null so I need to add an IF statement in there, which looks like this -
IF($V{SubTotal1}==null,0.00,$V{SubTotal1}) + $V{SubTotal2}
When using the 'Preview' option in JasperSoft Studio it works fine and I can view the report, but when executing it through netbeans I get the following error
Error evaluating expression :
Source text : IF($V{SubTotal1}==null,0.00,$V{SubTotal1}) + $V{SubTotal2}
net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
Source text : IF($V{SubTotal1}==null,0.00,$V{SubTotal1}) + $V{SubTotal2}
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:244)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:591)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:559)
at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1016)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:504)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:488)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:259)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:456)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2057)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupFooter(JRVerticalFiller.java:943)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupFooters(JRVerticalFiller.java:809)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportEnd(JRVerticalFiller.java:317)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:158)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:939)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:852)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:87)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:276)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:745)
at nmtbatchservice.jasperreporting.JasperReportGenerator.generateReport(JasperReportGenerator.java:53)
at nmtwebservice.reporting.BillIssuerReport.generateReport(BillIssuerReport.java:178)
at nmtbatchservice.NMTBatchService2.main(NMTBatchService2.java:155)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: Function IF not found
at net.sf.jasperreports.compilers.GroovyEvaluator.functionCall(GroovyEvaluator.java:73)
Any ideas? As I said - it works through Jasper Studio but not when I use netbeans.
Problem solved - I need to have the jasperreports-functions-5.2.0.jar to my project in Netbeans. Just a note, that Jar also requires Joda.org library http://joda-time.sourceforge.net/installation.html

BIRT report with parameters: Can not load the report query

I'm trying to run a report on Birt web viewer (JBoss) with a parameter and I get the following error:
- Grid (id = 1461):
+ Can not load the report query: 1461. Errors occurred when generating the report document for the report element with ID 1,461. (Element ID:1461)
Reports without parameters are working fine. Reports with parameters are running fine in Eclipse Report Designer.
Could someone give me advice please?
I had same kind a problem (ie. the report was throwing error while tried to fetch from the tomcat web container). To resolve this issue, I have added the database driver in the /WEB-INF/lib folder.
Please try this once and let me know if it works.
I solved my problem opening my report with "preview" instead of "frameset". This shows the real exception.
Might be you have not define id in your report parameter,either in report parameter or data set parameter.
In my case, the datasource for BIRT was not configured correctly. I needed to make sure the JNDI name matched what was in the config for my container.

Crystal Reports 8.5 / 9 - How do I remove a "default" value for a parameter?

Can anyone enlighten me on how to find and remove a default parameter in Crystal Reports 8.5 and/or 9? I get all confused by visual code techniques like this where I can't just grep the codebase and find the string I need to remove. :D
Basically, it looks like the former developer saved the report with a couple parameter fields populated, and I'm not sure how to un-populate them. So when I open this report for the first time and execute it, it just asks me for my database credentials - I never even see the:
Use current parameter values
Prompt for new parameter values
radio button selection the first time it is executed.
Any advice is appreciated.. thanks in advance!
In case anyone else happens upon this and needs a solution:
I have to uncheck
File -> Options -> Reporting -> Save Data With Report.
May this make your Crystal Reporting just a little less traumatic.