I’m wondering what is the best aproach for doing this:
I have a subworkflow with three steps (processes). Lets call them P1, P2 and P3.
The workflow takes 2 inputs (i1, i2) and i2 may be an empty channel.
P1 is allways executed with i1 as input and produces o1. If i2 is not empty then P2 is executed with o1 and i2 as inputs and produces o2. If i2 is not empty then P3 is executed with o2 as input else P3 is executed with o1 as input.
I have tryed several things but I feel I’m overcomplicating everything.
If you don’t know at the beginning of the run if i2 is emtpy or not, the easiest way to implement this would be to first collect and then concato2 and o1. You can then take the first element of the concatenated channel and flatten it again.