Ruport combing tables and writing to PDF

M

Mordechai Mr

Hi there,

I'm still learning my way through Ruby and recently I'm really
struggling with Ruport. I've referred to the lulu book, api docs,
examples and I..just can't get my head around this..

I want to specifically understand how to:
how to combine tables,
how to send more than 1 table to PDF
how to send a jpeg inbetween each of the tables (assuming mulitple
tables are sent)

I was successful in adding an image using the
ChunkyBacon example...but woudld like to understand how to insert an
image in between tables..

What I've tried...
Using Groupings..using pivot tables (pretty neat)...

Here's something nasty that I'd have to call my code..

require "ruport"
table = Testrun.report_table_by_sql("some embarrasing sql here...")
table2 = Testrun.report_table_by_sql("further embarrasing sql")

sorted_table = table.sort_rows_by("Name", :eek:rder => :descending)
sorted_table2 = table2.sort_rows_by("Name", :eek:rder => :descending)

sorted_table.swap_column("resultMax","name")
sorted_table2.swap_column("resultMax","name")


group1 = sorted_table.to_group("build_number")
group2 = sorted_table2.to_group("build_number")

grouping = Grouping(group1, :by => "build_number"), Grouping(group2,
:by => "build_number")

puts group1
puts group2


#ok at this point I have two tables but I've only figured out how to
send one to the PDF using save_as only
#which comes out badly formatted in terms of padding and spacing..
#
#I've tried using the formatters, and setting up stages but I can
never get them working...
#I want to be able to print each group (really the tables) and if
possible to insert an image inbetween
# each of the groups...

grouping[0].save_as("report.pdf")


I realize I"m asking more than one question I've sat ont his for a few
days...felt even worse after reading
James's comments regarding the Ruport book and how straight forward it
is...I've read it through and I'm still confused. I even went to
freenode..couldnt find anyone on there last night..

Can someone point me in the right direction?

Thanks.
Isley
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top