Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Multiple values in a single cell
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
fatcat  
View profile  
 More options Apr 13 2010, 12:48 pm
From: fatcat <dan.mcnu...@gmail.com>
Date: Tue, 13 Apr 2010 09:48:55 -0700 (PDT)
Local: Tues, Apr 13 2010 12:48 pm
Subject: Multiple values in a single cell
1 #!/usr/bin/ruby
   2
   3 require 'rubygems'
   4 require 'ruport'
   5
   6 table = Table(%w[Name Title Spouse Children])
   7 table << {  "Name" => "John",
   8             "Title" => "Accountant",
   9             "Spouse" => "Suzy",
  10             "Children" => "John\ Jr."
  11          }
  12
  13 table << {  "Name" => "George",
  14             "Title" => "Watchman",
  15             "Spouse" => "Joan",
  16             "Children" => %w[Georgette Georgina]
  17          }
  18
  19 puts table

Which outputs:

  +--------------------------------------------------+
  |  Name  |   Title    | Spouse |     Children      |
  +--------------------------------------------------+
  | John   | Accountant | Suzy   | John Jr.          |
  | George | Watchman   | Joan   | GeorgetteGeorgina |
  +--------------------------------------------------+

But what I'd like is:

  +--------------------------------------------------+
  |  Name  |   Title    | Spouse |     Children      |
  +--------------------------------------------------+
  | John   | Accountant | Suzy   | John Jr.          |
  | George | Watchman   | Joan   | Georgette         |
  |                              | Georgina          |
  +--------------------------------------------------+

Or something similar.  Any way to do this?  I've started looking at
customizing the Text renderer, but I am wondering if perhaps there is
an easier way that I've just overlooked.  I've not used Ruports until
a few days ago.  What a great bit of work here, I got rid of all my
ugly reporting hacks!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew France  
View profile  
 More options Apr 14 2010, 3:01 am
From: Andrew France <andrew-li...@odaeus.co.uk>
Date: Wed, 14 Apr 2010 17:01:15 +1000
Local: Wed, Apr 14 2010 3:01 am
Subject: Re: [ruport] Multiple values in a single cell
On 14/04/10 02:48, fatcat wrote:

I'm afraid as far as I can tell the text formatter code will only output
one row per row in the data table. You could probably iterate over each
row in the data table and create a new row with blank values whenever
you encounter an array value, but that's nasty and still wouldn't be the
exact output you're after. I think joining the array values with a
newline would break the table.

So yes I think you're right that the best way would be to override the
row builder in the text formatter!

Regards,
Andrew


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
fatcat  
View profile  
 More options Apr 14 2010, 9:37 am
From: fatcat <dan.mcnu...@gmail.com>
Date: Wed, 14 Apr 2010 06:37:38 -0700 (PDT)
Local: Wed, Apr 14 2010 9:37 am
Subject: Re: Multiple values in a single cell

Yes I tried appending a "\n" and it does indeed break the table.  OK,
I will look at the row builder...this is probably going to be a fair
amount of work, judging from a cursory look.  Perhaps I can think of
something clever :-|

Thanks for responding!  Cheers!

On Apr 14, 3:01 am, Andrew France <andrew-li...@odaeus.co.uk> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew France  
View profile  
 More options Apr 14 2010, 10:22 am
From: Andrew France <andrew-li...@odaeus.co.uk>
Date: Thu, 15 Apr 2010 00:22:42 +1000
Local: Wed, Apr 14 2010 10:22 am
Subject: Re: [ruport] Re: Multiple values in a single cell
fatcat,

Yeah it's a hard problem that's native to displaying it as text, it
wouldn't be so much of an issue in HTML or PDF. Getting the column
positioning correct based on the current text formatter will be very
difficult so I would hesitate in recommending even subclassing it.

You know, commas are good. :P

One last crazy thought, you could generate the table as HTML then use an
HTML to text converter!

Regards,
Andrew

On 14/04/10 23:37, fatcat wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel L. McNulty  
View profile  
 More options Apr 14 2010, 1:52 pm
From: "Daniel L. McNulty" <dan.mcnu...@gmail.com>
Date: Wed, 14 Apr 2010 13:52:04 -0400
Local: Wed, Apr 14 2010 1:52 pm
Subject: Re: [ruport] Re: Multiple values in a single cell

Hmmm, that is an idea.

I've spent the morning on this problem but don't have an elegant solution.
I'll sleep on it and try again tomorrow.

-- Daniel L. McNulty
  404-939-2225

On Wed, Apr 14, 2010 at 10:22 AM, Andrew France
<andrew-li...@odaeus.co.uk>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »