Hi everbody;
I have an array , i need to put it in bufferedReader to get the result in the output of the node, but i think that the node can only have a DataTableSpec as an input of the bufferedReader. so how can i do it ?
thanks a lot.
Hi everbody;
I have an array , i need to put it in bufferedReader to get the result in the output of the node, but i think that the node can only have a DataTableSpec as an input of the bufferedReader. so how can i do it ?
thanks a lot.
I don't really follow.
What are you storing in your Array?
You can add a ListCell to the DataRow that you then add to your BufferedDataContainer which you use to get the output table.
If you primatives of POJO's that have a KNIME Cell type you can just output the Array as a ListCell/CollectionCell
Cheers
Sam
Thanks Sam for your answer.
I tried to work with ListCell but it doesn't work. My array contains Strings and doubles. May be you can give me a piece of code that illustrates how to do it..
Thanks a lot
Sylia
Thanks Sam for your answer.
I tried to work with ListCell but it doesn't work. My array contains Strings and doubles. May be you can give me a piece of code that illustrates how to do it..
Thanks a lot
Sylia
@Override protected ColumnRearranger createColumnRearranger(DataTableSpec spec) throws InvalidSettingsException { ColumnRearranger rearranger = new ColumnRearranger(spec); DataColumnSpec colSpec = new DataColumnSpecCreator("ListColumn", ListCell.getCollectionType(StringCellFactory.TYPE)).createSpec(); rearranger.append(new SingleCellFactory(true, colSpec) { @Override public DataCell getCell(DataRow row) { String[] stringArray = new String[]{"one", "two"}; List<DataCell> stringArrayCells = new ArrayList<DataCell>(); for(String str : stringArray) stringArrayCells.add(StringCellFactory.create(str)); ListCell outputCell = CollectionCellFactory.createListCell(stringArrayCells); return outputCell; } }); return rearranger; }
thanks swebb.
Your code was helpfull, I need to have the rearranger only in the output port and not appended to the input table, i used this ligne of code.
i used this ligne of code , nut it doesn't do what i want.
return new BufferedDataTable[] { exec.createColumnRearrangeTable(inData[IN_PORT], rearranger, exec) };
have you a suggestion so solve ythis problem?
thanks a lot
Sylia