Variable filter after merge variable node

Hello,

how could I eliminate the unnecessary flow variables after the Merge Variable Node?

Thanks!

Roland

Hi

You can transfer them into “table row” by using “variable to table row” and then use column filter to omit the extra variables.

Mona

The approach suggested here doesn’t work - you can transfer flow variables to a table using the Variable to Table Row node, but the flow variables themselves still remain.

There isn’t a straightforward way to delete or remove flow variables (see previous forum discussion on this topic here: delete flow variable). As Iris mentions in that thread, a workaround might be to use the inherent local flow variable scope of components (previously called wrapped metanodes in the link) to effectively filter out flow variables created inside them.

Maybe there is a need for something like a “Flow Variable Filter” node. I would be interested to hear thoughts from others in the forum community about it.

10 Likes

Thanks for the clarification!

+1 @ScottF - would be great to have a filter to cleanup variables rather than having to use components and metanodes to drop them off.

2 Likes

Yes, definitely +1 from me for a Variable Filter node.

In discovering the issue raised by the following question, I realised that the ability to filter out Flow Variables would have been the perfect solution!

So it isn’t just a need to remove superflous variables, but a single flow split into different processing streams and then merged back via Merge Variables will always result in the flow variables from the first input stream trumping the flow variables from inputs 2 and 3, as there is no way to filter them out.

From the Merge Variables documentation:

“Note: If there are the same variables defined in different inputs, the standard conflict handling is applied: Top most inputs take priority and define the value of a variable.”

2 Likes

Noted! Thanks for the feedback in this thread. There is more interest in this feature than I would have guessed - we will definitely mention it to the developers. :+1:

8 Likes

Yes I can see the value of being able to remove any superfluous variables… although would suggest keeping any deletions (however this is done) to a minimum to ensure that the flow variablea are available towards the end of the workflow. This helps another future user identify what variables exist and can be used for further development of the workflow (as required). If variables are not carried through then in the future, a second variable for the same thing might be created. Obviously this results in duplication which can be problematic for transparency and overall workflow robustness.

Thanks, Ben

1 Like

I use compontents for this. Junk variables go in and only the important ones go out.

1 Like

Hi, just to add that I would appreciate a more explicit way to manage variable filtering as suggested above. Actually I am having difficulties to get to work via component configuration anyway. I have tried applying a manual filtering and wildcard/regex method to the exit of the component (choose variables to be visible outside the component) but still they seem to persist after that point. I have a load of junk variables arising from a couple of ‘case end switches’ and reading in a previously save variables file (# version exclusion using regex ^((?!#).)*$ ). Does anyone have an example work flow to share ?

Hi @ScottF

I discover this thread right now and definitely, I would also find really very helpful to have a kind of -Flow Variable Filter- node to tide up the workflow at a flow point where they are not any more needed.

So +1 from me too although @dr_snglr is a nice trick to achieve this too :wink:

Thanks & best regards
Ael

1 Like

Thanks for that feedback and +1 but I’m still finding the component exit trick is not filtering out the variables as it apparently should. As I said, I have tried various regex and wildcard methods but also manual exactly as @dr_snglr indicates, i.e.


But the excluded variable (same with force inclusion or exclusion) stubbornly remains downstream, i.e.
image
In this case I actually want to replace the variable ‘bnumber’ value with ‘bnumber_to_use’ and thought that by filtering it out I could just do a rename downstream using ‘string manipulation’ node… Incidentally I had originally tried using a variable rule engine, but this does not offer a ‘replace’ option like the data version - I suppose because of the way variables are handled (?)