Hi,
In my Transform java class, is it possible to overwrite the metadata of a field? something like this:
public boolean transform(DataRecord _source, DataRecord _target) {
DataRecord newRec = target.duplicate();
System.out.println("old metadata : " + newRec.getMetadata());
newRec.getField(“REF”).getMetadata().setSize(10);
newRec.getField(“REF”).getMetadata().setType(LocalField.STRING);
newRec.getField(“REF”).getMetadata().setNullable(true);
System.out.println("new metadata : " + newRec.getMetadata());
… perform data conversions and save the non-numeric value to “REF” …
}
and my system output is:
old metadata : DataRecordMetadata[fields = [org.jetel.metadata.DataFieldMetadata@53, org.jetel.metadata.DataFieldMetadata@4e, org.jetel.metadata.DataFieldMetadata@53, org.jetel.metadata.DataFieldMetadata@53], fieldNames = {REF=0}, fieldTypes = {0=N}, name = achan_output_1_txt_, recType = D, localeStr = null, skipFirstLine = false, recordProperties = {}, DELIMITED_RECORD = D, FIXEDLEN_RECORD = F]
new metadata : DataRecordMetadata[fields = [org.jetel.metadata.DataFieldMetadata@53, org.jetel.metadata.DataFieldMetadata@53, org.jetel.metadata.DataFieldMetadata@53, org.jetel.metadata.DataFieldMetadata@53], fieldNames = {REF=0}, fieldTypes = {0=N}, name = achan_output_1_txt_, recType = D, localeStr = null, skipFirstLine = false, recordProperties = {}, DELIMITED_RECORD = D, FIXEDLEN_RECORD = F]
so the metadata was not changed (from Numeric to String, etc)…
any ideas on how to change the metadata of a field inside my java class so that i can save non-numeric value to “REF”?
thanks,
al