permaculture playing cards*
The moose likes Beginning Java and the fly likes Transforming a table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Transforming a table" Watch "Transforming a table" New topic
Author

Transforming a table

alexandra kerr
Greenhorn

Joined: Jun 05, 2010
Posts: 4
Hi! I'm trying to transpose a table, with 3 columns: identifier, date and value.
Identifier is a number that identifies the client, date is dd/mm/yyyy and value is a number 0 to 10.
So this is the initial table:

Identifier date value
1200 06/12/2009 5
1200 06/12/2009 6
1200 07/12/2009 4
1200 08/12/2009 9

I need to transform it in another table, in which all values of the same client identifier are in the same row: separated with a blank when they have the same date and values from different days are separated with a -1. The initial table is transformed in:

5 6 -1 4 -1 9 -1
The initial table is a .txt and the final one should also be one.

I'm new to java and I've been trying to solve it using java, please could anyone help..
Martin Vanyavchich
Ranch Hand

Joined: Sep 16, 2008
Posts: 241
Hmmm quite a complex one Try breaking it in smaller pieces.

I don't know how good is your Java knowledge, but it would be probably best if you'd used a class to represent your rows. Possibly some sort of a collection to store them in, while you combine them together.

There are plenty of articles about writing and readnig form a file, so that shouldn't be a problem.

Regards,

Martin


SCJP 6, OCMJD 6, OCPJWSD 6
I no good English.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Transforming a table
 
Similar Threads
Sun Cirtification
can not deploy application!!!!
Slow Hibernate Save
String time validations(Javascript)
JTable problem / Sudoku problem - Problem with if