In my understanding a component should let through just the selected variables. For me it’s not working (let through all variables, actually my original variable live in the ‘component after’ node /regarding the owner ID/). It’s worked in the past (before the 4.3 update). Could someone help me in this topic?
Atteched a sample workflow and the print screen of it.
Thank You very much.
Variable_Error.knwf (34.3 KB)
If I understand correctly, you’re looking to have variables available inside a component and/or passed through to following nodes.
In that case, open up the component and configure the Component Input and Component Output. They will let you select the variables that are passed in and out of the component.
Hi @berti093 , it looks like the component has control only on what’s happening inside the component.
Here’s an example/test from your workflow. I modified the value of Variable from “variable” to “New Value”:
And also allow the variables through, we can see the new value for the variable as output from the component:
I keep the same change in value (“New Value”), but this time I exclude the variable from the component:
and the original value that was outside the Component is restored. It’s using the “global” (“global” from the point of the view of the Component) value instead:
I don’t think you can “remove” flow variables.
Hi @sjporter ,
What I would like is the opposite: If I have a lot of variables I want the component to limit which variable goes through and which is not (I configure the input and the output accordingly).
I configured my component input and output (I think correctly), but I cannot achive the ‘component after’ to have no variable.
Thank You for Your help!
hi @sjporter , he’s trying NOT to pass the variable
Dear @bruno29a ,
Thank You for the detailed explanation. When a workflow is big, it can be pretty messy with many variables, it would be good to manage them.
I remembered so that components can do that, but I was wrong then
You can prevent variables from exiting a component if they were defined within the component itself, but I don’t believe you can prevent a variable that is defined outside of the component from passing through the component.
Sometimes a flow variable filter would come in handy, although I can see that might further complicate some workflows.
You could still write your variables to table row, filter them and write them back to variable right?
write your variables to table row, filter them and write them back to variable
@Daniel_Weikert Great thinking; that’s a simple & elegant solution. I might look into making a related component…
Hi @sjporter and @Daniel_Weikert , I am not sure I understand how writing variables to table row, filter them and write them back to variable removes / filters variables…
When writing variables to table row, the variables still exist. So no matter what operations are done after, these variables are not going away.
Am I missing something?
I tried making a component for this and saw the same behavior. I’m going to ask around internally and see if anyone else has tried to filter variables out of a workflow in the manner you’re describing.
May I ask, what’s the reason for wanting to filter the variables out? As in, what’s the use case?
@sjporter in complex workflows where you use several metanodes or components you might use the same flow variable but the content might have changed. And then the first flow variable filled would get chosen.
So it could make sense to filter the variables or in some ways prioritize them. Or empty or delete them - like in programming languages.
I would assign individual names to flow variables to control which ones are used but I could see a case for filtering them. Not having though thru all the implications.
Thank You for the help. My problem or use case is the same as @mlauber71 : Messy workflows and taken variable names. (As I understand @mlauber71 's case)
Hey @berti093 / @mlauber71,
I received confirmation from the dev team that it’s not possible to remove flow variables from a workflow today. I submitted a new node idea in JIRA for this.
My recommendation for the workflow you shared in the original post would be to feed the table row into the component before converting it to a variable so that you can keep the scope of the variable within the component.
It’s almost never that I face the need to “clean up” variables on my side. Most of my workflows are built using multiple re-usable components (shared components that I built since using Knime), so I have full control on these variables - I only return any variables that are needed per component. Any other variables that are left are basically for the usability of the workflow itself.
So, I usually do not have any unnecessary variables around.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.