Hello.

Just woked up a few minutes ago. :) It was a nice dreamless sleep.

So I just want to thank everyone who tried to solve my little problem.
You know who you are.

Btw, I really appreciate the solutions. Reviewing them, I realized that
I was (again) being stupid and was focusing on the wrong problem.
Basically, it was material 40 (that has the same consumption on the same
line)  that kept throwing me.

Thanks again. :)

r/Alex

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Alex Rufon
Sent: Sabado, Hulyo 21, 2007 3:33 AM
To: Programming forum
Subject: [Jprogramming] Matrix Transform Problem

Hello.

This has stumped me. I just cant get my brains around this one.
 
I have this table (TABLE A):
TABLE A                                         
material_code   consumption     colorway1       colorway2
colorway3       colorway4       colorwayN
10      0.5     15      25      35      45      0
20      0.2     15      35      0       0       0
30      1       15      0       45      0       0
40      0.8     15      45      0       45      0

And I need to transform into this format (TABLE B):
TABLE B                                                 
material_code   color   total   colorway1       colorway2
colorway3       colorway4       colorwayN
10      15      0.5     0.5     0       0       0       0
10      25      0.5     0       0.5     0       0       0
10      35      0.5     0       0       0.5     0       0
10      45      0.5     0       0       0       0.5     0
20      15      0.2     0.2     0       0       0       0
20      35      0.2     0       0.2     0       0       0
30      15      1       1       0       0       0       0
30      45      1       0       0       1       0       0
40      15      0.8     0.8     0       0       0       0
40      45      1.6     0       0.8     0       0.8     0

Please note that the number of colorways may be from 1 to N. Its
arbitrarily sized. 

I've also attached a capture of the excel file on the event that this
becomes unreadable.

I would really appreciate if anybody would give my problem a go.
Otherwise ... I'll do a brute-force solution. I have an idea on how to
do this but its going to be really ugly with a lot of branching and
conditions. Oh well, I'm going get some sleep (been away for 20 hours). 

Thanks in advance to anybody who give this a go. I appreciate any help.

Thanks again.

r/Alex
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to