This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Groovy and the fly likes How to print all the fields in a record Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "How to print all the fields in a record" Watch "How to print all the fields in a record" New topic
Author

How to print all the fields in a record

Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 381
I am trying once again to get this to work and I'm now using Groovy 1.7. I used eclipse 3.6 and the groovy console and got the same results.

Why does line 16 not print out all the columns for that record?
Why does it not print the value of each field? What is it printing, the type?

Here are the first few lines of my output


Here is my code that I am running on groovy 1.7:

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Please tell us when you crosspost the same question in different forums. Check this FAQ.


[My Blog]
All roads lead to JavaRanch
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

I think you'll find an answer here.
Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 381
Oops! my bad!

Sorry. Yes, I posted this question a year ago and when I still did not get a response a month ago, I posted again and I still have not received a response. As you can see from http://groovy.329449.n5.nabble.com/How-to-display-all-the-fields-in-groovy-Sql-sql-td370614.html I have posted the last two entries with no response.

I have tried the suggestions of the previous posts and I cannot get them to work. I know the information I want is in there

So I am posting here here hoping for a response. I know the row data is in there and I can get it if I hard code the column names. But I want a generic tool. I can print the column names I retrieve from the metadata. The information is there! How do I get the data out of the rec object. They (blackdrag) told me to use the eachrow function and I just cannot get it to work!

Does it work for you?

Thanks,
siegfried
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to print all the fields in a record
 
Similar Threads
Project Euler problems with Scala
Groovy - Basic Question
problem with html variable inside jsp
LinkedHashMap - trying to use the method removeEldestEntry
values change unexpectedly due to threading issue?