Adding rowID from one table to a new column in another table

The idea is really simple. If I have two input tables with these datatablespecs,

Table 1:

RowID1   m1   m2

Table 2:

RowID2   s1   s2

I want to make final table look like this.

RowID1   m1   m2   RowID2

I used ColumnRearranger to add column to the final table, but when processing SingleCellFactory to fill in the cells in the new column, the getCell(DataRow row) method only access table 1 row. How do I make it so that I can access Table 2 to put RowID2 instead of RowID to the final table?

Thank you very much.


This has got to do with ID correlation of two tables, which is basically filtering rows from the first table by comparing to the second table and returning only rows that is within filtering range, then on the final table tell user which rows from the second table each rows in the final table has been selected by adding second table's row ID to the final table.

I just need getCell(DataRow row) in SingleCellFactory to take the row on table 2, not the final table.

Maybe the ColumnRearranger is not what you should be using. It's good if you do column based transformation on a single table. As soon as you start removing rows from the or changing the row order, you will need to use a DataContainer.

If you had good reasons to use a ColumnRearranger, you should use a dedicated CellFactory class that you pass the second table as well (so you'd need two constructors -- one used from configure() and one used from execute()). But then again, it doesn't sound as if you really want to use a ColumnRearranger...

Maybe you should have a look at our Joiner implementation (or actually just use the Joiner?)