Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I tried to follow the below link to understand how to use dynamic datatype and extract its content.
https://help.talend.com/reader/KxVIhxtXBBFymmkkWJ~O4Q/WX1guuvSnxZg5nBBQ26LBQ
My source data (attached in the doc) which has mixed datatype (integer,varchar and date).
I have designed the job as
tFileInputDelimiter (column ->Dynamic) --> tJavaRow.
Used the below code in tJavaRow.
Dynamic columns = row3.dynamic; for (int i = 0; i < columns.getColumnCount(); i++) { DynamicMetadata columnMetadata = columns.getColumnMetadata(i); System.out.println(columnMetadata.getName() + ": " + columns.getColumnValue(i) + "; " + columnMetadata.getType()); }
But I could find the the datatype derived from columnMetadata.getType() of all the extracted column is showing as id_String.
And If i use columnMetadata.getDBType(), then i am getting all the extracted column datatype as varchar . Output data attached in the sample.
Can anybody let me know how to get the exact datatype (like integer ,date) for the required column, instead of varchar for all the columns.
Hi @shameer ,
When you read the data dynamically from a file, Talend will consider everything as string only.
To see the actual datatype, you can provide the schema in Input File with actual datatype and then use tWriteDynamicFields, and after that you can use your method to see the actual datatype.
Thanks and Regards,
Subhadip