How do I create (Meta) datapoints which do not log values under certain conditions?
-
I am creating a few datapoints intended to log only certain values.
For example if x is false, for example, there is no valid data to log, so we'll try again next time y changes but no value now.
Pseudo-code:
if (x === true)
then
z = y;
else
// z does not get a value
end ifI find that when I don't return a value in a Meta datapoint, it gets logged as a zero (0.0). How do I accomplish this?
Aldo
-
There has been a little discussion about making that possible, but currently it is not (to my knowledge). So, to do that, you can either use a scripting data source, or you can cause some errors and they won't produce values in that code path. For instance...
if( a == 1 ) return 50; else return "No value!";
And you can do the same thing by throwing an error rather than returning the wrong datatype, i.e.
throw "No Value";
In either case you may wish to suppress the events for the point / source.
-
OK, I'll give that a try. Can you suggest any other approaches for filtering unwanted values?
You mentioned using a scripting data source; how would that be different?
-
You could try the Discard Extreme values option on the logging setting and return a high value when you don't want to log any data. So rather than throw no value through 999999 and have the data point set to discard any value over 1000.