# Rails with ireport

**URL:** <https://www.ruby-forum.com/t/rails-with-ireport/51600>\
**Category:** Rails\
**Created:** [January 4, 2006, 2:30am UTC](https://www.ruby-forum.com/t/rails-with-ireport/51600 "2006-01-04T02:30:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@paul](https://www.ruby-forum.com/u/paul)\
**Post date:** [January 4, 2006, 2:30am UTC](https://www.ruby-forum.com/t/rails-with-ireport/51600/1 "2006-01-04T02:30:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![paul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@paul](https://www.ruby-forum.com/u/paul)\
**Post date:** [January 4, 2006, 4:13pm UTC](https://www.ruby-forum.com/t/rails-with-ireport/51600/2 "2006-01-04T16:13:51Z")

</div>

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/](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](http://www.addsw.it/wiki/doku.php?id=repy_jasper)

Regards  
Simo

---

<div class="post-metadata">

**Author:** ![paul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@paul](https://www.ruby-forum.com/u/paul)\
**Post date:** [January 4, 2006, 5:28pm UTC](https://www.ruby-forum.com/t/rails-with-ireport/51600/3 "2006-01-04T17:28:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![paul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@paul](https://www.ruby-forum.com/u/paul)\
**Post date:** [January 5, 2006, 1:21am UTC](https://www.ruby-forum.com/t/rails-with-ireport/51600/4 "2006-01-05T01:21:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![paul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@paul](https://www.ruby-forum.com/u/paul)\
**Post date:** [January 6, 2006, 2:13am UTC](https://www.ruby-forum.com/t/rails-with-ireport/51600/5 "2006-01-06T02:13:09Z")

</div>

thanks that will be very helpful

---

<div class="post-metadata">

**Author:** ![paul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@paul](https://www.ruby-forum.com/u/paul)\
**Post date:** [January 5, 2006, 12:44pm UTC](https://www.ruby-forum.com/t/rails-with-ireport/51600/6 "2006-01-05T12:44:43Z")

</div>

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
