Hello,
I'm doing a Java Snippet that I would like to get the column data type.
I'm trying something like:
try {
out_ColumngetClass = getCell(v_Columnname, tString).getClass().getName();
} catch (Exception e) {
out_ColumngetClass = "Error";
}
But this code needs me to previously known the column type.
- v_Columnname: a variable with the column name I'm testing
- tString: the column type
- out_ColumngetClass: the out variable
Any ideas how to?
I want to have as output in variable out_ColumngetClass the name of the Class.
Thanks!
Iris
2
Hi Juan,
is there a specific reason you want to use the Java Snippet for this?
The Extract Table spec will generate you the spec of the current table with all properties.
Best regards,
Iris
Iris,
I'm trying to apply different operations depending if the column is an Integer, Double or String.
I'm trying to mask data on several columns, and if the column is an Integer, I type "Other"... If the column is an Double, I write a random number.
I´m following the Java Snippet with a Case selector to do so.
Any other ideas on how to get this done?
Thanks!
Iris
4
In this case maybe the function isType(name, type)* is sufficient?
Than you need to go over all columns and in a if else construct do the respective change?
Best, Iris
Iris,
Yes! I think isType(name,type) could help! Thanks!
https://www.knime.org/files/nodedetails/_misc_java_snippet_Java_Snippet.html
I will test it right away!