I need to do a processing model that has several optional vector inputs, but that produces only one output. I have separate conditional processing branches for all inputs, but in the end I would need to merge all of the created branch outputs into one. Here comes the problem. As the merge needs to be done after all the conditional branches are done, I need to set it as dependent of all of the branches but because of that, the merge tool is not completed at all if even one of the conditional branches above is not completed. So, as a result, the model doesn't produce anything if some of the inputs are not set.
Does anyone have a solution for this?
Even workarounds do. My QGIS version is 3.16.9.
The picture should clarify my idea. The model is meant to calculate all kinds of statistics to the given point objects ("Kohteet"). "Oksien ehtolauseet" is the conditional branch tool checking which inputs are given and so starting or not starting separate processing branches for the inputs. The merge tool in the end should merge what there is to be merged after the branches with inputs are processed, but it at the moment fails if all inputs are not given and thus all branches are not completed.
So, if I give an input to both "Koulut" and "Kaupat" the both branches are completed and finally merged as they should. If I, however, give an input to only "Kaupat" the model doesn't perform merge and thus doesn't return any output either, because the branch of "Koulut" is not performed and the merge tool is dependent of it. It should, however, in that case merge the result of the branch of "Kaupat" with nothing and return that as an output.
(For the sake of fast testing, the merge is at the moment set after the first tools of the first two branches even though the branches are meant to continue after removing the null geometries and there are several other branches and inputs in the model as well.)
My Python skills are limited to very basic coding, so I seek some kind of a solution in graphical modeler or some piece of code that I could add to Python script to make it work.