Hi guys,

I'm currently coding another Kettle plugin and I have an issue for
which I need some help.
I have some incoming data, like :
Col1 | Col2 | Col3
AAA BBB CCC
AAA BBB CCC

After some custom transformations or my own, I want my dataset to be
extended with 2 more columns, like :
Col1 | Col2 | Col3 | Col4 | Col5 .... or more new columns
AAA BBB CCC DDD EEE
AAA BBB CCC DDD EEE

I wrote something like below, after looking to some other code.
My plugin is running "fine", but my dataset is still limited to the
first original 3 columns. I made some other trials, and I'm only able
to output the original first columns OR the new columns ... but never
the original columns AND the new ones.

Here is my routine. Thanks if you can help. I'm sure something stupid
is hidden there ... maybe with the clone(), or a resizearray is
needed ... I don't know.

Many thanks


public
boolean processRow(StepMetaInterface smi, StepDataInterface sdi)
throws KettleException
{
meta = (KGeoCodingPluginMeta)smi;
data = (KGeoCodingPluginData)sdi;

Object[] r=getRow(); // get row, blocks when needed!
if (r==null) // no more input to be expected...
{
setOutputDone();

returnfalse;
}

if (first)
{
first = false;

data.firstNewFieldIndex = getInputRowMeta().size(); // Defined in the
xxxData.java class
data.outputRowMeta = (RowMetaInterface)getInputRowMeta().clone();
meta.getFields(data.outputRowMeta, getStepname(), null, null, this);
}

try {
// This line is retrieving the source field position = the dataset
column on which the transformation will be done.
ColPos = data.outputRowMeta.indexOfValue(meta.getAddressField());

// Here I call my custom transformation routine
// the array "items[]" will be redistributed below
// array "items[]" has been declared at class level
items = MyTransformationroutine(r[ColPos].toString());

// No issue with that, I controlled the returned values and all is
fine.
// Now I want to build my final dataset = original columns + new
columns (3 news in my example). I think issues are here.

//reserve room
Object[] outputRow =
RowDataUtil.allocateRowData(data.outputRowMeta.size());

for (int i = 0; i < data.firstNewFieldIndex; i++)
{
outputRow[i] = r[i];
}
outputRow[data.firstNewFieldIndex] = items[0]; // 1st transformed
column
outputRow[data.firstNewFieldIndex+1] = items[1]; // 2nd transf column
outputRow[data.firstNewFieldIndex+2] = items[2]; // 3rd transf column
putRow(data.outputRowMeta, outputRow); // for next step

}
catch (XPathExpressionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (SAXException e) {
// TODO Auto-generated catch block


e.printStackTrace();
}
catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (checkFeedback(linesRead)) logBasic("Linenr "+linesRead); // Some
basic logging every 5000 rows.
returntrue;
}



Thanks

Vincent Teyssier
__________________
Vincent Teyssier
BI Architect
http://open-bi.blogspot.com
06.89.77.50.37

--
You received this message because you are subscribed to the Google Groups "kettle-developers" group.
To post to this group, send email to kettle-developers (AT) googlegroups (DOT) com.
To unsubscribe from this group, send email to kettle-developers+unsubscribe (AT) googlegroups (DOT) com.
For more options, visit this group at http://groups.google.com/group/kettle-developers?hl=en.