"Inject Variables" seems to execute always

In the attached workflow, the flow variable EndLoop is set to “false” by the Inject Variables node in the non-active branch. Is this the desire behaviour? If so, what is the rationale behind it?

test_inject_variables.knwf (15.6 KB)

Hi @mpenalver

I am afraid you have to give a bit more context there. Why do you think there is some unexpected or weird behavior? Where do you have the workflow from and what is it supposed to show?

I looked at the workflow and I don’t see anything unexpected or erroneous happening. The Endloop variable is “false” because that is what was defined by the user in the Variable Expression node. It also doesn’t change if other data is connected or the other branch is active. Unfortunately I can’t tell you why the WF creator set it to “false” at this point and what she/he wants to do with it.

Thanks for your response, @Alice_Krebs. This is a simple WF I created to illustrate the fact that the value being injected is the one set by the inactive branch instead of that set by the active one, as I would expect. I want to set a different value for a variable depending on which branch is active. With this behaviour, which to me is counterintuitive, it doesn’t seem that I can use the Inject Variables node for that.

Hi @mpenalver

Flow Variables are always send over nodes. So they are also send over end if nodes and over inactive nodes. However, only if they exist.

We are aware that this is not straight forward and will take care that we keep on improving this in the future.

You can solve this by deactivating the generation of the flow variable. If the variable is not generated it cannot be send to the next node. This would for example be possible like this


Thank you @Iris. In the meantime, I implemented a different workaround based on the same principle:

But I like yours better because it only adds the flow variable of interest. It is, in any case, good that you are aware of the issue and have an improvement in mind.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.