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: 
Anonymous
Not applicable

Remove field from dynamic schema based on data type

Hi Folks:

 

Using Dynamic schema to read table from SQL Server, and I want to remove all "timestamp" data types.

Do you have suggestion on how to loop thru the dynamic schema and modify it at run time?

For example, can I throw a tJavaRow between my source and target, & remove the timestamp column?

If so, can you please post a sample?

thanks!!

Labels (3)
2 Replies
GerryD
Contributor
Contributor

I have the same problem! Trying to keep a dynamic job as simple as possible so if an existing component could conditionally remove columns based on data type that'd be ideal. 

GerryD
Contributor
Contributor

Well, I was finally able to get around my issue by increasing the size of the field in the dynamic column with this (should be able to do other things like removing the column or changing types etc similarly): 

 

Dynamic columns = row1.newColumn;

for (int i = 0; i < columns.getColumnCount(); i++) {
DynamicMetadata columnMetadata = columns.getColumnMetadata(i);
if (columnMetadata.getDbType() == "timestamp" )
{
columnMetadata.setLength(50);
}
}

output_row.newColumn = columns;