# [#3785] - Right-click OPEN SUBREPORT does nothing

 Category: Bug report Priority: High Status: Closed Project: iReport Designer Severity: Major Resolution: Won't Fix Component: Reproducibility: Always Assigned to:

Right-clicking on a subreport element has an "Open Subreport" option, but choosing it does nothing. The subreport does not open. This used to work in iReports 3.0.0

22
Joined: Nov 17 2008 - 5:00pm
Last seen: 10 years 6 months ago

#1

iReport tries to resolve the jrxml location from the subreport expression. Now a feedback is given if the subreport can not be found.

#2

I have 3.5.2 and have the same exact problem. No warning about being able to find the file. The same templates work fine with 3.0.0 so even if a warning is mentioned, I feel there's probably something else wrong preventing it from locating the file in the first place.

#3

The error message is fine but there is still a feature regression from the old iReport (3.0.0). Right click should attempt to look in the current working directory for the template if it is a parameterized path. For example, I might have defined the subreport as

$P{reportPath} + "/templates/compiled/myreport.jasper" In iReport 3.0.0, right-click on the parent report would open this subreport even though$P{reportPath} was unknown and provided by the application.

#4

You have to define a default value for $P{reportPath}, even the empty string is enough. Giulio #5 It would be nice if there were an "OpenSubReportListener(String subReportExpression)" that is called after the normal open actions so that plugins could do their own work. (e.g. So I could load them from database directly or parse the expression by myself and do my own logic) What dou you think?? :-) C-Box #6 Ok, now I see what you say jmartens, yes, iReport 3.0.0 was a bit more smart, it was trying to look for the jrxml in the same dir of the parent too (and I wrote really nice code there...). Ok I'll change the logic again, thanks for your patience... C-Box: I'll think about a SubreportOpenerProvider interface. It may be registered using the layer.xml #7 Tried the latest iReport (3.6.0) but still having the same issue. #8 I fixed the code again (improved actually). Now it tries many other possible searching paths and srategies to look for the subreport file. I added then the SubreportOpenerProvider interface to plugin custom logic to open the sub report file. The implementation class must be registered in the layer xml inside the folder ireport/SubreportOpenerProvider). Here is an example: <folder name="ireport"> <folder name="SubreportOpenerProviders"> <file name="com-jaspersoft-ireport-jasperserver-JSSubreportOpenerProvider.instance"/> </folder> </folder> Giulio #9 Hmm, well maybe getting closer but still no good (not like 3.0.0). I just installed iReport 3.6.1. I have my templates all located in a directory called C:/Program Files/Clarus/tomcat/shared/classes/content/reports/templates The compiled (.jasper) get stored in C:/Program Files/Clarus/tomcat/shared/classes/content/reports/templates/compiled I open a jrxml template which contains links to a subreport. The subreport expression is$P{reportsPath} + "templates/compiled/ResultSummary.jasper"

When I attempt to right-click, open my subreport jrxml file, I get an error

Unable to open the subreport:

It is true, there is no .jrxml file in that compiled directory, just in the templates/ directory.

iReport 3.0.0 (and prior) handled this just fine however. I'm not sure what logic it is using but it's always able to find the right subreport.

Thanks

#10

Gosh! you right! I forgot this final case! To be fixed in the next release :-) I'm so sorry!

Giulio

#11

This time should finally work as expected!

#12

Hi Giulio,

as I currently migrate from 3.5.3 to 3.7.6 I wanted to implement the SubreportOpenerProvider for my plugin. But it doesn't work as expected!

I debugged the "OpenSubreportAction" of iReport and recognized that you FIRST try to locate the file from expression via "Misc.locateFileFromExpression" but therefore the valueclass must be of type String. If this is not the case, an exception is thrown and the "notifySubreportProviders" is skipped! :-(

My SubReport-Expressions are of type "net.sf.jasperreports.engine.JasperReport" and my expression is a call of a given Parameter (e.g. "$P{AFPSDataContainer}.getReport(DruckVorlageReportTyps.RT_VERTEILERINFOS)" as I pass all needed Objects from outside in one "AFPSDataContainer" that holds all needed SubReports (as JasperReport Objects) and SubDataSources .... So from the static constant within the expression I can locate the needed JRXML in Database. Would you be so kind to create a second method within your interface just with two parameters -> e.g.: public File openingSubreport(JrxmlEditorSupport ed, JRDesignSubreport subreportElement); that I could implement to load the needed file just from expression via my plugin??? Would be VERY VERY NICE. tia + regards from snowy Dresden/Germany# C-Box #13 • Status:Feedback Requested» Confirmed Hello, this problem is still present on version 5.6.0 Exact same situation than above, the subreport is on the same folder of the main report... My subreport expression is$P{DatiQuestionario_Cont_path}

When I try to compile it I obtain this, I think that this is related because I have full path access to the folder. (also started the program with admin rights)

Errors compiling D:\SviluppoXRM\workspace\it.crm.cbv\reports\ReportQuestionario.jasper!
Compilation exceptions: com.jaspersoft.ireport.designer.compiler.ErrorsCollector@12a27b0 net.sf.jasperreports.engine.JRException: An error has accurred compiling the subreport: C:\Program Files (x86)\Jaspersoft\iReport-5.6.0\ireport\fonts     at com.jaspersoft.ireport.designer.compiler.IReportCompiler.compileSubreports(IReportCompiler.java:1486)     at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:522)     at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) Caused by: net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: C:\Program Files (x86)\Jaspersoft\iReport-5.6.0\ireport\fonts (Accesso negato)

#14
• Resolution:Reopened» Won't Fix
• Status:Confirmed» Closed

iReport is no longer being developed nor supported. Furthermore, versions before 6.2.0 have all reached end of life. Please version up to the latest version. The current report layout tool is Jaspersoft Studio.

https://community.jaspersoft.com/wiki/jaspersoft-product-version-end-lif...

#15

thanks

randomness