i have a Problem with my flow - the Data is not always the same but we want to use the same flow. Therefore I added two ways how the date will be prepared.
But one way will always be empty and I would need to connect the outputs to the next node wit only one input. As it could be the case that the first way could not be executed i cant use the concatanate node…
Here is a picture to see the problem I think my explainations are not that easy to follow
Hello,
To choose between If switch or Try/Catch, it would be usefull to know :
“as it could be the case that the first way could not be executed” but why ? Is there anyway to know that before executing operations (so that If switch may be decide a priori) or it could be only noticed during the operations (and Try/Catch is the way).
Best,
I think the issue in my case is that I have here this Unpivoting node which is using a wildcard. In the case the Column is not there I receive a warning "No column value defined for unpivoting operation. Which ends in “No data available!”
Therefore I think I can’t use the empty table switch.
also the try node seems not to work in this case - i tried to have a look at the examples but I was not able to run it due to missing extentions which I was not able to install.
I also tried it with a minimum of nodes but something is not working or do i use the nodes wrong?
Do you mind sharing this minimal example so I can take a look?
I think as @JPollet said earlier - it is important to understand what scenario is happening in your workflow - i.e. is an empty table produced or is one part of the WF failing?
Depending on that the solution will look differently.
One option could be : column filter as it is then Extract Table Spec node (this node list in particular the column names) and test if there exist the column(s) use for pivoting. Then define (with variable) the node If switch with the result of the test.
Joel
thanks a lot for your support - this is what I really like in this community.
here is an example flow. The main problem is that for Dataset 1 we do not know what values will be delivered within the Topic section. Dataset 2 has not the Topic section at all and this is the reason why I would need the if node or the try node.
Thanks for the example. Some initial feedback as to why neither the try/catch nor the empty table nodes were helping:
Try Catch:
The Unpivot node unfortunately does not fail (so show an error) when no column that matches the pattern is in the data set - it produces “only” a warning and thus the second branch is never triggered
Empty table: The unpivot node is also not producing an empty table (= successful execution, but no data in the table other than headers).
Do not yet have a solution, but will look into this tonight - therefore sharing my train of thought for now:
Find a way to make “something” fail - this would require checking if “Topic |*” pattern is in the data set - if that works with a node that produces an error you can then use the try / catch
Check if a column is in a data set and use this to create a variable for an IF Switch of CASE Switch Node
ensure there is always at least one column that matches the pattern - add it using a constant value column and the value in each cell is the same and should be something you’d never see as data in your other columns (e.g. “/-$35465–##”) - once you are done with your unpivoting you filter out those rows using a row filter searching for “/-$35465–##”
I try too with Try/Catch but with no success : I’m interesting for a possible solution !
Here is a suggestion with a test on the presence or not of
Topic columns and two branches for processing (option 2 as @MartinDDDD and I explain earlier). It works : at least it produces something but is it what you are waiting for ?
@JPollet have you considered along the lines of the suggestions from @MartinDDDD to extract the table specs and then filter if a Column of that name is present?
Yes of course.
Just one thing : for If Switch the ports are label “top” and “bottom” which is uncommon in Knime and puzzle me each time ! It gives the possibility of “both” but I don’t know when this could be applicable.
Joel