Hi,
============ my input FMT ==================
…
…
============ my input data ==================
ITEM_ID, COST
1, 10.00
2,
3, 30.00
============ my output FMT ==================
…
…
========================================
my transform method in my transform class:
public boolean transform(DataRecord _source, DataRecord _target)
{
DataRecord source = _source[0];
DataRecord target = _target[0];
Iterator fields = source.iterator();
while (fields.hasNext()) {
DataField sourceField = fields.next();
String fieldName = sourceField.getMetadata().getName();
Object value = GetVal.getDouble(source, fieldName);
if (value != null && value.toString().length() > 0) {
String temp = value.toString();
SetVal.setString(target, fieldName, temp);
}
}
return true;
}
the output result:
ITEM_ID, COST
1, 10.00
2, 10.00
3, 30.00
the COST for ITEM_ID #2 is NOT supposed to be 10.00, it should be blank… looks like it is taking the value from the previous record (COST from ITEM_ID #1) if i do not explicit set the value to blank in my transform method…
this is incorrect… is there an internal buffer that CloverETL uses for record field values that is not being cleaned up properly?
so my workaround is to add this to my transform method:
if (value == null || value.toString().length() == 0)
SetVal.setNull(target, fieldName);
but i am still puzzled by why when a field value is not set for a current record, it takes the value from the previous record??
thanks,
al