In this thread 4 Possible inputs into one output - #2 by n8n you gave me already a great advice but now it came to the point where output 0 goes to two nodes but only one was executed as well if it would have been both I guess I would get 2 Items output.
You have any idea how
to make sure with Switch output 0 both nodes get executed and
still only get one output like aggregate the Items?
But you will need to set the workflow’s execution order to legacy in the settings.
By the way, that one does not have much sense {{ 1 | parseInt }} as you are already comparing the numbers. You can replace it with the 1 as Fixed value.
Here’s your Switch solution reworked which also implements the idea of utilizing {{ $runIndex }} suggested by @barn4k.
Explanation
You have only one instance when a single Switch output engage 2 branches (output 0, aka state 0), which should be followed by a singe call to Pipedrive API with “PD - Search Filter” node. As the branches are loosely connected, that is, they can be used either individually or alongside each other, the Switch1 node will run either once or twice. As we need “PD - Search Filter” node to be called just once in any of the cases, the (zero-based) condition $runIdex == 1 could be ignored.
Warning
This, however, does not take into account the condition when “PD - Create deal field (MKXduration_unit_not_convertible)” node fails . If it is significant to prevent running “PD - Search Filter” node under these circumstances (state 0), then this solution is not suitable and needs to be extended further by checking for such a condition when the “system” is in state 0.