I’m in situation where I extract columns for an unpivot operation through a regex selection on column names. The resulting column names configure value and remain columns for an unpivot node. It’s possible to have a situation where there are no value columns, which i need to mitigate. I’m trying to use the try/catch nodes to gracefully handle this, but so far I’ve not been successful. Do i misunderstand the way try-catch works?
Hey there,
I think the challenge with try/catch is that it works in situations where your node is actually throwing an error.
From what I see on the screenshot it appears that the unpivot node does not fail (this typically is indicated by a red “X”), but throws a warning (yellow triangle with exclamation mark).
Given that you exactly know what may be causing the error (e.g. no columns to be selected) I’d propose to tackle this problem not using try / catch, but via IF Switch and End IF nodes:
After applying your regex, check if columns were identified and use this to define which branch of the IF Switch to activate - note: you want to use a flow variable to define which port to activate and the flow variable needs to be of type string and either be “top” for top port, or “bottom” for bottom port (this sometimes makes it a bit confusing).
Given that you seem to be fairly advanced with your KNIME Skills I think you should have no trouble exploring this with the hints given Good luck!
Cheers,
Martin
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.