• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transforming a table

 
alexandra kerr
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 241
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic