Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
shameer1
Contributor II
Contributor II

Create a dynamic column and extract its content

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. 

Labels (2)
1 Reply
Anonymous
Not applicable

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