How to filter or route variables

Revision as of 08:32, 20 August 2020 by Registered User


How to filter or route variable to UI?

1. When is it useful to filter variables ?

In some cases it is useful to filter some variables. For instance, when you perform post-processing you may want to plot only the post-processed variable and not the original one. Here are some solutions to :

  • Hide useless variables
  • Plot some variables on different charts
  • Plot only the post-processed variable, not the original one.



In the following chapters you are going to see two solutions to perform this routing or filtering :

  • Create 2 groups of variables
  • Add switch nodes


2. First solution : Create 2 groups of variables

You can create 2 different groups of variables (variable nodes), and consequently the same number of processing nodes. One can be connected to the gauge and the other one to the chart.


Flow with 2 Groups of variables.png

3. Second solution : use Switch Node

You can use the “switch node”, used like a filtering node on the output of the processing node. The switch node filters your variable on the following property : msg.payload.variablename and myVariableName.


Flow with switch node.png

Switch node configuration :

  • Name - Choose a name for your node
  • Property - msg.payload.variablename is the condition to select a variable. Here you are going to select the needed variable thanks to its variable name.
  • Condition - == yourVariableName if you want to filter only a variable. You can use other rules such as != yourVariableName to filter all variables except a variable.

Here is an example of a "switch node" configuration panel :

Switch node configuration.png

/!\ Be careful, the variable name has to be exactly the same than the one in the processing node (without space before and after). You can copy/paste it from the processing node /!\

You can either use several “switch nodes” in series or in parallels to filter multiple variables :

3.1. "Switch nodes" in series

If you want to block some variables you can use "switch nodes" in series with the != condition.

In this example, the first "switch node" allows to block the average temperature variable and the second "switch node" to block the voltage variable. Thus, this two variables won't be plotted on the graph.

3.2. "Switch nodes" in parallel

If you want to select specific variables you can use "switch nodes" in parallel with the == condition.

In the previous flow, the temperature and the voltage variables are each one routed by a switch node. The two switch nodes are in parallel. Thus you can either plot the two variables in the same or in different graphs.