How do I merge data, when one of the inputs is not taken/walked by the workflow?
I have a Function Node (1) that returns items. Based on a Switch Node (2) I route what is going to happen next. After the routing I want to collect/merge (3) my items again.
The problem is: if my data source only has 1 type of item the merge does not occur since only one input is populated.
I tried the “Always Output Data” on the Switch, SQL and Keep Source Merge Node but I can not get this to work.
How would I go about that? I thought of using a function not as areplacement for the Merge (3) but it seems to be only be triggered by either the top route or the bottom route.
Ah no then it should be fine. We changed the execution behavior multiple versions ago and I thought with those changes it should actually work already. Have to have another look.
As a workaround, you can try to add another Merge-Node between “Keep Source Merge” and “Merge2”. Set to mode “Pass Through” for “Input 2” and connect Input 1 with the Switch-Node (output 0) and Input 2 with Keep Source Merge.
I have 2 emitting functions. one emits data that is of the same type, the other is of different types. I use the Set Node to add a new property dummyData with value false to both routes. But when it travels the top route it a) sets dummyData to true and also triggers the bottom route via a pass-through merge. the passed through input data is evaluated based on the dummyData property once again and if it is true it forwards-the dummy data, else it forwards the “good” data. After both branches I merge the 2 route via append and filter out all items with dummydata: true.
Pretty cumbersome imho but it seems to do the trick.
Edit: well in my bigger scenario it does not work like that. seems to be a race condition since the resolving on the database actually takes a while but preppying the dummyData is instant.
Edit: Holy smokes. It seems to work now. I can not follow the code of the commit completely but it seems to do the trick. What is the recommended Was to collect items now?
I pulled the nightly and updated my docker container.
What would you now recommend to make the parallel execution after the switch work? The workflow with the pass-through and append merge and some flag indicating which data to keep? I can’t seem to paste the JSON from the test case to look into it.
No, it is impossible that this fix would make any difference in that regard.
The nightly build docker images is however slightly different than the default image as it does get build totally differently. Can also not imagine that this should cause any problems here, but if it worked before and now not, this is the only thing I can think of. Maybe you would then have to wait for the proper release next week.