Forum Discussion

Lewis_Beard's avatar
2 months ago
Solved

Do widget expressions support if/then value substitution?

A user has a need to treat zero values on some jitter graphs as if they were NULL, and not roll up into some averages on a widget. I know that I can add a complex datapoint to the datasource, or clone the datasource and add a complex datapoint separately. Or I could declare the range of valid results to exclude zero in the datapoint on such a datasource. But I really dont want to maintain a datasource (new or changed).

Can widget expressions do thing like seeing a non-display variable to an expression that is if/then/else, instead of just math? Something logically equivalent to:

if (AvgSDJ <> 0) {return AvgSDJ;} else {return NULL;}.

NewAvgSDJ = NULLIF(AvgSDJ, 0)

Or perhaps there is some strictly mathematical way to do it? I really dont want to alter an official datasource or maintain a clone, but I need to get a solution.

Thanks!

  • If I understand you correctly, and you didn't mention the type of widget, but you can try making a Virtual Datapoint in a graph widget (and set the real datapoint to "do not display") that looks something like this (untested):

    if(le(MyDatapoint,0),unkn(),MyDatapoint)

    That should have the graph not show any values that are 0 or less. Virtual Datapoints use the same expressions as Complex DataSources.

  • If I understand you correctly, and you didn't mention the type of widget, but you can try making a Virtual Datapoint in a graph widget (and set the real datapoint to "do not display") that looks something like this (untested):

    if(le(MyDatapoint,0),unkn(),MyDatapoint)

    That should have the graph not show any values that are 0 or less. Virtual Datapoints use the same expressions as Complex DataSources.

  • As far as I know, you can't just have an empty value in the table or have the table exclude rows based on their values.

    One trick that I've used in the past where I want to default-sort values backwards, is to make the numbers negative. So 100 shows up as -100, 1000 shows up as -1000, etc. then just tell users to ignore the (-) symbol. Messy but may help.

    Also if you want to point out that these gig interfaces are actually only running 100mbit is a problems, perhaps you want to alert on that situation then use the NOC widget to show that.

  • It is a graph widget, I somehow missed that page, or forgot it exists.

    if (eq(AvgSDJ,0), unkn(), AvgSDJ) is probably what I want. Thanks!

  • Hi I am trying a similar thing. I want to show only the value of a datapoint when it is 100 in a Table widget.

    I have now applied the following expression on the datapoint:

    if(eq(Speed,1000),unkn(),Speed)

    Now it shows the datapoints that do have the value 100 but the table also shows the datapoint that have 0. I only want to show the datapoints that have the value 100. how can I achieve that?

  • Thank you David, that works partially indeed. Still it also shows the interfaces that are not equal to 100, shown with value NaN.

    Would it be possible to only show the interfaces where the value is 100?

     

  • Thank you Mike.

    We first want to get insight how many Access Point interfaces are running on 100 Mbit and determine it is a problem or not. Then we'll decide on enabling static thresholding or not.

    Thanks for the help, it was instructive!👍