# To control Workflow Stream Using If Switch using Flow variable from a Python Snippet

**URL:** <https://forum.knime.com/t/to-control-workflow-stream-using-if-switch-using-flow-variable-from-a-python-snippet/27913>\
**Category:** KNIME Analytics Platform\
**Created:** [October 9, 2020, 2:07pm UTC](https://forum.knime.com/t/to-control-workflow-stream-using-if-switch-using-flow-variable-from-a-python-snippet/27913 "2020-10-09T14:07:44Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [October 9, 2020, 2:46pm UTC](https://forum.knime.com/t/to-control-workflow-stream-using-if-switch-using-flow-variable-from-a-python-snippet/27913/2 "2020-10-09T14:46:01Z")

</div>

This combination could look something like this. You would have to give a variable that either says “top” or “bottom” and then use an if-switch to do what you want to do.

> if($${Ivar\_py\_value\_switch}$$ \>0) {return “top”;}  
> else {return “bottom”;}

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/f/c/fcfbeb59ebe19a4851138498ef32df4e1f51be05.png)

> **[Three ways to handle combination of Flow variables from Python and If switches...](https://hub.knime.com/mlauber71/spaces/Public/kn_example_python_flow_variable_if_switch~rv1bVAbSk1vowJGa/current-state)**
>
> Three ways to handle combination of Flow variables from Python and If switches In one Python environment a Flow Variable for the usage in KNIME will be filled …

–

Edit - newer version: [Switch - Examples of how to use Case When – KNIME Community Hub](https://hub.knime.com/s/FiCsBGkVxgWV5_fJ)

---

_[View the full topic](https://forum.knime.com/t/to-control-workflow-stream-using-if-switch-using-flow-variable-from-a-python-snippet/27913)._
