i’m beginning using jasper report and the servoy plugin and i have a problem with subreport when i pass to the report my foundset as report’s data…The subreport alone runs without problem, but when i run my master report i don’t see anything in the band where i have my subreport…
Where is my mistake ???
Please give us some more information.
Are you using a foundset in the subreport or running a query?
I use in the main report a foundset and in the subreport i access directly my database and i make a filter with a parameter…
Do i need to pass something in the plugin ?
I make the call to the main report and i do nothing for the subreport…
If no errors, but the band of subreport is in white, the problem is that do not load the subreport, probably because is not in the same path that in design mode.
Best regards.
The subreports is in the same folder of the main report…the band is white, no errors…i have inserted an incorrect path in the subreport expression and so i have an error message.
But my question is also: is there something i have to write when i call the plugin or i pass parameters to the plugin if my main report ha a subreport ?
The problem should be caused from the connection ? in the subreport i have set to use “connection expression” and like expression i have $P{REPORT_CONNECTION}…
but if i have a foundset in the report, is it the same thing in the subreport where i make a call directly to the database ?
Hi Michele. I have never tried a main report from foundset and subreport from a database SQL at the same time.
Try using a DB connection in the main report (even you be sending a foundset) that way the subreport will also have the same connection. I think that the subreport is linked to something in the main report, I mean the subreport runs a query that filters the records on a field in the main report; if that is the situation you should send that field to the subreport as a parameter so the query knows what to retrieve.
Maybe this image can help you a little bit.
[attachment=0]JasperSubreport.png[/attachment]
I hope this helps.
How can i make a DB connection, or better how can i say to the report that it has to work in DB connection ?
But if i have a foundset in my form, for example on the customer table, and i need to make a report where i have the list of my customer and for every customer i want to create the subreport for the customer’s contacts what i have to do ? i have not found info about thsis situation…i have thought i have to pass the foundset and then to make a subreport directly in the database, but if someone has differnt suggests…with example please, i’m not an expert in jasper, ireport, etc, etc…
Hi Michele.
Have a look at this link http://www.servoy.com/content.jsp?t=727&mt=393 you will find some videos that can help you.
After watching the videos, if still in troubles, just let us know.
Good luck.
I have seen these videos many times, but i have not found the answers i find…
The main question is that i have done previously…foundset in the main report and query on database table in the subreport…
On using the plugin there is no deep documentation…
Now i have to know if what i ask is possible…we use the navigation framework for our application and in it is normal to work with a foundset where the user makes every kind of filter and then pass to the report the data already filtered.and then connect every table i want taking it from the database…it seems a correct think…
Hi, Michele.
The problem should be caused from the connection ?
By default, the subreport uses the same connection as the master report. You do not need to change this, as this is not the problem.
But my question is also: is there something i have to write when i call the plugin or i pass parameters to the plugin if my main report ha a subreport ?
Yes. You probably set up your subreport to accept a parameter to use in the subreport’s embedded SQL, but did you configure the subreport on the master report to send the parameter? On the master report, click on the subreport. In the properties sheet under Subreport Properties, scroll down to the Parameters property and click on the expansion button on the right. Add a parameter to pass to the subreport here. Give it a name and expression. The name MUST MATCH the name of the parameter in your subreport. The expression is whatever you wish to pass from the master report to the subreport. It can be a field, variable, master report parameter, constant, etc.
I hope this helps!
The problem about the connection i said was because the first report works on a foundset, while the subreport works on a table and i thought these were two different ways to connect to the database.
In the subreport i don’t pass any parameter because the test i was making had not any filter i made a select * from table only to verifiy to see the subreport then i’d have to do a filter…but it doesn’t function immediately, so i think it is not a problem of parameter.
Thanks
The subreport alone runs without problem…
If the subreport runs stand-alone, and it is using the same connection as Servoy, then it is not the connection with which you are having difficulty.
If you pass a foundset to the master report, the subreport will also try to use it, regardless if you have an embedded SQL in the subreport (that is why you are getting the white band…the subreport cannot find the subreport data in the foundset). You must parameterize the subreport. If you pass a parameter from the master report to the subreport, and use the parameter in the embedded SQL of the subreport, the subreport will work.
In the master report, click on the subreport, then create a parameter to pass to the subreport as I described earlier (for example):
Name / Expression: ORDER_NUMBER / $F{order_number} NOTE: order_number is a field from the foundset
In the subreport, create a parameter to receive the value being passed from the master report; it must have the same name and type (for example): ORDER_NUMBER with type java.lang.String
Then, in the subreport embedded SQL statement, use the parameter:
SELECT * FROM table WHERE order_number = $P{ORDER_NUMBER}
Try it!
I have insertedf the query with the parameter, but i can’t see the subreport. At this time i think that what i need is not possible…Even on the servoyforge forum i have not received any answer …
Report foundset based and subreport table based don’t run…
I attach my reports even if without data they cannot be run, but if someone lokk at the xml to see if there is an error…
Thanks
Reports.zip (31.8 KB)
My apologies for the delay in responding…I have been out of the office since 31 September 2011.
I looked at your JRXML files, and the manner in which you are passing and receiving parameters appears to be correct.
Here is one more thing to try…
In the master report, create a group, and put the subreport in the group footer. For the group expression, use the id_ccf field (the same one you pass as a parameter to the subreport), and see if that works. Good luck!