From: "Abinoam Jr." Date: 2012-01-26T07:42:42+09:00 Subject: Re: Ruby Database Query with Grouping Hi, One of the problem(s) is here... t_ImmaterialSizes2 = 0 t_ImmaterialSizes2, as you wrote, points to an Array (line 4). You should access its content by index like t_ImmaterialSizes2[102] Another of note is at t_DateProcessed.each do |date| #PUT EACH SETS OF ITEMS THAT ARE NEEDED FOR THE REPORT TO THE CONSOLE (EVENTUALLY WILL BE OUTPUT TO A FILE) puts "#{t_DateProcessed} , #{t_ImmaterialSizes2}" end Look, "each t_DateProcessed item is passed 'through' the variable date". So, inside the each block, 'date' is what you want. I'll try to refactor and send to you because I think the way you're going is not pointing toward what you want. (just a minute). Abinoam Jr. On Wed, Jan 25, 2012 at 7:16 PM, Courtney Fay wrote: > I am working in an application that has a Lucene and apache derby > database.  As my ruby skills are quite new, I am not sure where ruby > ends and the application begins. > > At this point, I am trying to run some counts for data that has been > indexed in the system.  Attached is the beginning of a script.  I know > it's wrong.  Let me preface with that.  What I am trying to get is > different counts, and group them by a piece of captured metatdata called > "DateProcessed". > > What I would end up with is something like > > Date Processed  - Count of Items - SizeBytes of Items - Immaterial Items > - SizeBytes of Immaterial Items - etc > > 1/1/12 - 500 - 20934823 - 210 - 239048 > 1/9/12 - 1000 - 40102983 - 330 - 435875 > > etc. > > What I get with the current attached script is this: > 1/1/12 - 500 - 20934823 - 210 - 239048 > 1/1/12 - 500 - 20934823 - 210 - 239048 > 1/1/12 - 500 - 20934823 - 210 - 239048 > 1/1/12 - 500 - 20934823 - 210 - 239048 > 1/1/12 - 500 - 20934823 - 210 - 239048 > 1/1/12 - 500 - 20934823 - 210 - 239048 > 1/1/12 - 500 - 20934823 - 210 - 239048 > 1/1/12 - 500 - 20934823 - 210 - 239048 > 1/1/12 - 500 - 20934823 - 210 - 239048 > 1/1/12 - 500 - 20934823 - 210 - 239048 > 1/1/12 - 500 - 20934823 - 210 - 239048 > 1/1/12 - 500 - 20934823 - 210 - 239048 > > > etc. > > Can anyone help me?  I am hoping that as I learn to fish, my questions > will get better and I will become more independent. > > Attachments: > http://www.ruby-forum.com/attachment/6934/countsbydate.rb > > > -- > Posted via http://www.ruby-forum.com/. >