Using column to grid inside a loop

I am trying to do a fairly complex pivot where I'm splitting out each row, then transposing it, then using the column to grid to make a grid of 4 like so:

Obs1   1 2 3 4 5 6 7 8 9 10 11 12

Transpose:

Obs1
1
2
3
4
5
.... etc

Then grid:

Obs(1) Obs(2) Obs(3) Obs(4)
  1             2         3       4 
  5             6         7       8
  9           10        11     12 

Transpose again

Obs(1)  1   5    9
Obs(2)  2   6   10
Obs(3)  3   7  11
Obs(4)  4   8   12  

and add this to to the next processed row.

Obs(1)         1   5    9
Obs(2)         2   6   10
Obs(3)         3   7  11
Obs(4)         4   8   12  
NextObs(1)  1   5    9
NextObs(2)  2   6   10
NextObs(3)  3   7  11
NextObs(4)  4   8   12  

The problem is when I try to put this in a loop the column to grid control requires manual intervention to put the current column name into the "include" box. Is there a way to automatically select whatever column is there.

Obviously I could write an R node to do this (but that would be cheating)

Any suggestions greatly appreciated!

So the problem is you do have different column names in each run?

 

If so you can use the extract column header node to get a uniquely named table (ont the second port)

 

Now it gets a bit tricky.... you need to change the rowid...

 

okay I made you a workflow,

cheers, Iris