Hi to all,
I’m using KNIME to read thousands of XML-Files. I convert the XML-files with several XPath nodes. Thereason why I do this is that the strucutre of these XML-Files is “breathing” so the content is varying. Sometimes the last XPath loop have to skip because of an empty table. So I added an Empty Table Switch node with and END If node to my workflow. In the screenshot the Column Filter node produces a table without any columns but with one empty row. I guess this empty row is the reason why the Empty Table Switch node don’t detectd a empty table.
In other words what do I do wrong?
Hi @Brotfahrer, welcome to the forum.
You’re spot on, the empty table switch doesn’t consider the table empty because of the empty row inside it.
An alternative that should work in your case is to use the Extract Table Dimension node together with a Rule Engine and regular If Switch. Then you could check for 0 columns instead of 0 rows.
hope this helps!
thanks for this option.
Is it right that the output flow variable is String? In the IF Switch I have to configurate the PortChoice to my new generated flo variable “switch” like in the screenshot.
Unfortunately the IF Switch doesn’t react to the value of the flow variable. Thus the XPath Node still throws an error and the END IF Switch as well
Hi there @Brotfahrer,
welcome to KNIME Community!
Your output flow variable should be string, that’s correct. And it must have value top or bottom otherwise both output port will be activated as seen on your screenshot. You can have a look at workflow examples on KNIME Hub containing IF Switch node. Here is one for example.
Additionally Extract Table Dimensions node already provides you flow variables with information about number of rows and columns so technically you don’t need Table Column to Variable node
Edit: For another workaround using Remove Empty Rows node check this topic - Feature request: Remove Empty Rows: Option to remove/retain missing value cells
you put me on the right way!
However in my workflow the Rule Engine Variable Node dosen’t work @Corey showed me. The solution for my workflow is to write the true condition like the false.
My workflow looks now like this without the Table to Variable Node
Thanks in advance @ipazin and @Corey
glad you made it. Should work also with TRUE in a rule but maybe something was miss-configured…
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.