# Ruport for beginner

**URL:** <https://www.ruby-forum.com/t/ruport-for-beginner/175284>\
**Category:** Ruby\
**Created:** [September 10, 2009, 4:00pm UTC](https://www.ruby-forum.com/t/ruport-for-beginner/175284 "2009-09-10T16:00:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![baiki](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/4af34b/32.png) [@baiki](https://www.ruby-forum.com/u/baiki)\
**Post date:** [September 10, 2009, 4:00pm UTC](https://www.ruby-forum.com/t/ruport-for-beginner/175284/1 "2009-09-10T16:00:50Z")

</div>

Dear Ruby community,

I am looking for a “simple” PDF output for monthly salaries. Input is a  
CSV file and output should be a PDF file.

I just get more or less these fields from the CSV  
id, name, valid\_time and date

While creating the tables and preparing the output, there have are  
several calculations to be done before PDF generation.

However, I am not yet there ☹

## Here is what I got so far:

#!/usr/bin/ruby

require ‘rubygems’  
require ‘ruport’

#csv\_input = File.open(‘testtest.csv’,‘r’)

csv\_input = \<\<-EOF  
id,name,valid\_time,date  
1,baiki,5:00,9/10/2009  
1,baiki,1:45,9/14/2009  
2,lee,6:00,9/8/2009  
2,lee,6:00,9/7/2009  
2,lee,6:55,9/6/2009  
2,lee,6:00,9/8/2009  
1,baiki,5:00,9/11/2009  
1,baiki,4:00,9/12/2009  
1,baiki,2:00,9/13/2009  
EOF

table = Table(:string =\> csv\_input)

table = table.sub\_table(%w[id name valid\_time date])

table.rename\_columns(‘id’ =\> ‘ID’, ‘name’ =\> ‘Name’, ‘valid\_time’ =\>  
‘Hours worked’, ‘date’ =\> ‘Date’)

grouped\_by\_id = Grouping(table, :by =\> ‘ID’, :order =\> :ID)

puts grouped\_by\_id

## #csv\_input.close

My question for now. How can I sort within the grouping according to the  
date. Basic sorting is asc ID.

Thanks  
Baiki
