Icon

Variable Filter Example

<p>The Variable Row Filter is essential when working with many flow variables in a large workflow. It keeps the flow variables "traveling" through the workflow connection in a handy and human-readable size. Some possible use cases include:</p><ol><li><p>Keeping the scope of flow variables precise to where they are needed without passing them to downstream nodes:</p><ul><li><p><strong>Upstream Filtering</strong> is the process of filtering only the necessary flow variables before they enter a component. This clarifies which flow variables are needed inside the component without opening it.</p></li><li><p><strong>Downstream Filtering</strong> is the process of filtering flow variables after they exit a component. This ensures that only the necessary variables are passed on to the rest of the workflow.</p></li></ul></li><li><p>Eliminating unnecessary flow variables after merging variables using the Merge Variables node.</p></li></ol><p>You can download and run this workflow using your locally installed KNIME Analytics Platform. To ensure compatibility, use the latest version of the software.</p><p></p><p>Workflow Steps</p><ol><li><p><strong>Generating Flow Variables</strong></p><ul><li><p><strong>Extract Context Properties</strong>: Output all the properties of the running workflow (name, path, etc.) as flow variables.</p></li><li><p><strong>Data Generator</strong>: Generate a few rows and convert the row values of one column ("Universe_1_1") into flow variables.</p></li><li><p><strong>Variable Creator</strong>: Artificially create six different flow variables, including the "setting" flow variable we want to keep.</p></li></ul></li><li><p><strong>Merging Flow Variables</strong></p><ul><li><p>Merge the more than thirty flow variables generated in the previous step.</p></li></ul></li><li><p><strong>Filtering Flow Variables</strong></p><ul><li><p><strong>Direct Filtering</strong>: Use the Variable Filter node to filter the "setting" variable directly from the Merge Variables node.</p></li><li><p><strong>Mid-Branch Filtering</strong>: Pass the flow variables through nodes like "Table Creator" and "Column Filter," then use the Variable Filter node connected to a table input port to filter the "setting" flow variable. You can connect other nodes with a table input port to the Variable Filter node.</p></li><li><p><strong>Additional Port Filtering</strong>: Add another port (flow variable port) to the Variable Filter node and pass only the "setting" variable along with the one from the recently added port.</p></li></ul></li></ol><p>After filtering, you can pass a clean set of flow variables to downstream nodes and components, ensuring a well-organized and efficient workflow.</p>

Variable Filter Example

  • The KNIME Variable Filter node allows users to filter flow variables by name. It can filter variables simultaneously from any connection type and even from multiple connections.

  • This workflow showcases how to output the desired flow variables ("setting" and "New Variable") from different input ports using the Variable Filter node.

  • Please click the description icon in the left bar to learn more about the workflow details.

Filter for the desired "setting" flow variable
Variable Filter
Collect workflow context information
Extract Context Properties
Convert row valuesinto flow variables
Table Column to Variable
Merge flow variable stacks
Merge Variables
New Variable
Variable Creator
Remember, that flow variablestravel with connections,so the whole flow variable stackis available here
Column Filter
Random data
Data Generator
Filter for the desired "setting"flow variableusing the data port
Variable Filter
Flow Variables generated here: variable_1 variable_2 variable_3 variable_4
Variable Creator
Merge flow variables.Note that the "setting"- and"New Variable"-flow variables areavailable at both ports
Variable Filter
Some data
Table Creator

Nodes

Extensions

Links