Rails with ireport

Hi all, since there isn’t good reporting for rails, I’m thinking to use
jasper report instead. Can anyone tell me how can I integrated them
together? especially how can I pass parameter from rails to jasper
report.

Paul C. wrote:

Hi all, since there isn’t good reporting for rails, I’m thinking to use
jasper report instead. Can anyone tell me how can I integrated them
together? especially how can I pass parameter from rails to jasper
report.

I don’t know it, but you see how ruby datavision bridge works
(http://rubyforge.org/projects/rdb/).

Some days ago, I created a small ruby library that reads iReport files
and produces PDF output (using ruby fpdf); it is very incomplete and
supports only few features (no data grouping, for example); if you are
interested, you can find it at
http://www.addsw.it/wiki/doku.php?id=repy_jasper

Regards
Simo

Paul C. wrote:

Hi all, since there isn’t good reporting for rails, I’m thinking to use
jasper report instead. Can anyone tell me how can I integrated them
together? especially how can I pass parameter from rails to jasper
report.

I did this once from PHP <-> Jasper. The way I accomplished it was by
setting up a servlet that would read a database table and load various
parameters from it, consequently handing those parameters to a report
job and running the report. The report was then handed back as a pdf to
the browser.

Not very complicated at all. I had a PHP report “controller” that PHP
scripts could call into and set parameters in the table, and the
controller would then call out to the servlet’s url.

You could simply pass them via a http post, but I found this unwieldy
after awhile.

HTH,

John

thanks.

do you know how can I just call the shell to run a java program passing
rails parameter along that actually run the jasper report to generate
the report.

the next part I’m not sure how, can to pass the output page back to
rails

thanks that will be very helpful

Paul C. wrote:

thanks.

do you know how can I just call the shell to run a java program passing
rails parameter along that actually run the jasper report to generate
the report.
the next part I’m not sure how, can to pass the output page back to
rails

DataVision bridge first creates a xml file containing rails report
parameters, then creates a commandline string like "java -cp
<package.jar> ".
Options contains parameter file name, output file name, database
settings and other.
Then, executes the report with
system( “#{command_line}” )
Finally, in the controller, send the report to the browser with:
send_file( , :stream => false )

This works because it is possible to execute DataVision from the command
line. I dont’t know if JasperReport also supports this feature (
otherwise, you can create a small java program that read parameters from
a file and uses JasperReport engine to generate and export report to a
file)

Simo