var db = ‘db:///RIS_archive/reports_’;
//////////other attempted strings follow://///////////
//controller.getDataSource();
//controller.getServerName();
//‘db:/RIS_archive’;
//‘db://RIS_archive’;
//null;
//forms.b0300_reports.controller.getDataSource();
//forms.b0300_reports.controller.getServerName();
//////////////////////////////////////////////////
plugins.jasperPluginRMI.runReport(db,‘print_report.jrxml’,null ,‘view’,$parameters);
When I run this I get an error dialog for all of these settings for db:
No connection returned for database: db:/ris_archive/reports_
(or whatever string I was trying?)
Can someone point me to some real documentation or something so I can get this working? I don’t even understand what this first parameter does. What database does it need? Is this something in the file iReport created?
You can provide the db server connection name or the foundset in the first parameter.
The easy way to work with Jasper report is sending the foundset to it. So that we can access the fields directly inside the report.
plugins.jasperPluginRMI.runReport( foundset,… )
or
plugins.jasperPluginRMI.runReport( forms.form_name.foundset,… )
Suppose a field having name “field1” and another “relationship1.field2”, then we can have fields in the iReport named “field1” and “relationship1.field2”.
Which will directly access the field values.
The first parameter needs to be a Connection Object. This can be retrieved via:
Servoy 4.x
controller.getServerName();
Servoy 5.x
databaseManager.getDataSourceServerName(currentcontroller.getDataSource()); //if you are in Globals.js
databaseManager.getDataSourceServerName(controller.getDataSource()); //if you are in a formScript
This Parameter specifies the Database Connection the report will use for sending querys and retrieving Data.
Hope this helps.
Ps.
If you follow pradiptabs approach, to use a foundset, you will face the problem, that you can test your report ONLY! via Servoy. You can’t just ‘let it run’ in iReport to test if all works out. Also it makes debugging your report much more complicated, as the Exceptions generated by iReport are not passed 100% correctly to Servoy. Sometime there is even NO! exception at all, for example if you forget or mistyped your report directory you will get a blank error.
This is not very convienient.
So you have to decide which path to go ![Wink ;)]()
jmcneely
Have you considered the VelocityReport plugin? You can learn more about it here: http://code.google.com/p/servoy-stuff-velocityreport/
It has some real advantages over Jasper in certain situations, and is very powerful and simple to use.
JasperReports is a great reporting engine, and iReport is a great report design tool, but if you want to use native Servoy objects for data filling e.g. foundsets, datasets record objects etc., the JasperReports plugin + iReport is quite cumbersome.
The VelocityReport is better integrated with Servoy and provides nearly all the same features - “subreports” n relations deep, charting, barcoding, advanced layout, rendering to PDF and viewing in a smart-client viewer window that is nearly identical to the Jasper viewer. It is fully web and smart client compatible for Servoy 5!
Instead of learning iReport, you can create your reports in HTML and CSS.
As Jeff pointed out:
jbader:
It has some real advantages over Jasper in certain situations
(my highlighting here)
Note that it really is a complementary tool to Jasper, - it might work well for you depending on the kind of reports you want to make.
And if the kind of reports you want to make are easily done in html, then yes, the VelocityReport plugin will make your life a lot easier than Jasper Reports.
Understand that the use of HTML and CSS is great for dynamic layout, but not so great for layout where you need pixel-precise positioning.
HTML strength is in its dynamicity, I would say its ‘elasticity’, compared to Jasper’s strength which is ‘pixel’ positionning.
I would say, get familiar to both and then you will know when to use one or the other.
The best way to imagine in advance if a report would require VelocityReport or JasperReports is to imagine the same report in html in a browser, if you think that it would be easy to do in plain html (with CSS), then VelocityReport is your friend!
Hey there Patrick!
A few friendly rebuttles (for the sake of clarity) ![Very Happy :D]()
Note that it really is a complementary tool to Jasper
It could be and it could not be really, it depends on what you need. You could certainly use only Velocity so long as you didn’t need a Jasper-specific feature right? I use them both currently so I certainly see how they could be complimentary, but I don’t think they need to be. Velocity can absolutely stand alone as a reporting tool don’t you agree?
pixel-precise positioning
I don’t think that Jasper renders report output more “precisely” than the Velocity plugin, but it does certainly offer rendering to more output formats, and the same report will render to those output formats precisely to the pixel. Maybe that is what you mean?
The best way to imagine in advance if a report would require VelocityReport or JasperReports is to imagine the same report in html in a browser, if you think that it would be easy to do in plain html (with CSS), then VelocityReport is your friend!
I think this is a little misleading b/c when most people think of CSS, they think of continous media, they don’t think of CSS 3’s paged media module, which is what Velocity supports for the print media type. Users don’t really need to envision their report in a browser at all in my opinion b/c with the paged-media module + print media type stylesheets + rendering to PDF there really is no browser to envision your report in.
Point taken ![Wink ;-)]()
I was basically sayint that using CSS for pixel-precise positionning is really reserved to HTML/CSS guru, I didn’t say it would be impossible… One would use tools like DreamWeaver or alike to do that kind of stuff (I wouldn’t do it in a text editor), but is it really easier than iReport? I doubt it. Now you could argue that it is easier to find a good HTML integrator than to find a good JasperReports integrator.
Also BTW, if your browser is smart and new enough you can use the printPreview function to use the print stylesheet and CSS3.
GevatterTod:
The first parameter needs to be a Connection Object. This can be retrieved via:
Servoy 4.x
controller.getServerName();
Servoy 5.x
databaseManager.getDataSourceServerName(currentcontroller.getDataSource()); //if you are in Globals.js
databaseManager.getDataSourceServerName(controller.getDataSource()); //if you are in a formScript
This Parameter specifies the Database Connection the report will use for sending querys and retrieving Data.
OK, this looked promising. Obviously I want to be able to test the look of the report in iReport so I am looking at this technique instead of the other.
Before, I got the error dialog:
No connection returned for database: db:/ris_archive/reports_
Now, I get this error dialog:
Unknown hyperlink targe 0
So, maybe closer? Still no joy.
Thanks for the help guys, including the parameter approach, I will possibly be trying that anyway.
Here is a little Code Snippet which might help you:
var server_name = databaseManager.getDataSourceServerName(currentcontroller.getDataSource()); //I trigger my reports in a global function, so I have to use CurrentController
var argus = new java.util.HashMap(); //the Parameters for your Report will go in here.
argus.put('myParameterForJasperReport', forms.myForm.myParameterForJasperReport); //apply a parameter
var reportName = "myReport.jasper";
var exportTo = "pdf";
plugins.jasperPluginRMI.runReport(server_name,reportName , 'myDestinationFileName.'+exportTo , exportTo, argus, null);
Something else:
var db = 'db:///RIS_archive/reports_';
This will not work. You need a Connection Object, not a Connection string.
Hope this helps.
This will not work. You need a Connection Object, not a Connection string.
That is also not really correct: Is Servoy, when targeting a specific database, you do so based on the name of the database server (Server name).
It’s just a string, not an object.
Paul
Ok.You’re right ![Very Happy :D]()
You have to specify the Datasource for the JasperPlugin. This can be a Database Connection or a foundset. Quite in Fact you pass An Object of unknown type to the Plugin. It evaluates what kind of Object it is.
source = JSArgumentsUnwrap.unwrapJSObject(source, plugin.getIClientPluginAccess());
[...]
if (source instanceof String)
{
jasperReportRunner = jasperReportService; // run report remote
}
else if (source instanceof JRDataSource)
{
jasperReportRunner = new JasperReportRunner(jasperReportService); // run reports in client
}
else
{
throw new Exception("Unsupported data source: "+source.getClass());
}
[...]
JasperPrint jp = jasperReportRunner.getJasperPrint(source, report, params, plugin.getJasperReportsDirectory(), plugin.getJasperExtraDirectories());
I was not thinking for Servoy, but for what I am doing in my Java Web Application where you have to provide a ReportConnection Object for the JasperReportsFillManager. ![Embarassed :oops:]()
Sorry about that.