Hi guys, i have this problem: i need to add a column to an existing DataTable, but the problem is that the elements of the cells of the new column, are stored in a text file. My problem is that i have no idea how to implement the method getCell to retrieve the
I read the example in the documenatation of the site and i did something like this:
private DataColumnSpec createOutputColumnSpec() { DataColumnSpecCreator colSpecCreator = new DataColumnSpecCreator( "Infered", StringCell.TYPE); DataColumnSpec newColumnSpec = colSpecCreator.createSpec(); return newColumnSpec; }
Then in the execute method i have something like this:
// instantiate the cell factory CellFactory cellFactory = new InferedCellFactory(createOutputColumnSpec(), File results); // create the column rearranger ColumnRearranger outputTable = new ColumnRearranger(inData[IN_PORT].getDataTableSpec()); // append the new column outputTable.append(cellFactory); // create the actual output table BufferedDataTable bufferedOutput = exec.createColumnRearrangeTable(inData[IN_PORT], outputTable, exec); // return it return new BufferedDataTable[]{bufferedOutput};
In the end, the method getCell in InferedCellFactory.
public DataCell getCell(DataRow row) { //i don't know how to retrieve results from a text file based on the passed DataRow }
Can anyone help me? Thanks in advance!