If-else without duplicating remainder of workflow

Hi everyone,

I have two sets of data which are similar in structure (columns, datatypes) but different in contents. Based on a set of conditions (in my case only variables) I want to determine, which of both sets of data is loaded to the workflow to be processed with the same logic.

An obvious solution would be to use an IF-ELSE-Processor for this. But - unless I missed something - in this scenario, I had to duplicate the logic in the remainder of the workflow, which I want to avoid because it is exactly the same. Another solution was to create a smaller workflow which evaluates the conditions in an IF-Else-Processor and saves the right data to an intermediary table, which avoids redundancy but isn’t too pretty. Another solution I came up with is to include all the relevant variables to the table name but this bloats up table names, which I also don’t like.

What I am looking for is more or less an IF-ELSE-Processor with two input ports and one output port. In case the statement(s) evaluate to TRUE, the left input should be read and forwarded and otherwise the right. Has anyone found good solution to this?

Another solution that I came up with just now is to union both data sets, append a flag and the filter the whole thing based on the conditions.

do you always have either one or the other of the inputs? or is it possible to have unions or subsets of the unions?

Hi Max,

besides the UNION, another option could be to use 2 workflows:
You could have a wrapper workflow that just analyses the variables that determine which data to load and based on the result you could call the other workflow via Flexible Rest API processor. In this Sub-Workflow you could load the data via a variable which you can set from the wrapper workflow when you trigger the API call.

1 Like