Hi,
Anyone have any ideas how to check for a null value in PLEG ?
PLEG fails with an “unable to perform arithmetic on a nil value” if one of my variables is empty/non existent in a simple PLEG formula. a+b+c - when the device wakes up then the variable appears and all is good, but as these are battery devices I’m working with I’m concerned that one day when one runs out of batteries my PLEG routine will stall with this error.
Basically I want PLEG to replace the answer to the formula with a 0 if any of the parts of the formula are null when run
Any ideas ?
Cheers
David
Come on guys - surely someone has had this before and got a solution…Richard ?
Please - there doesn’t seem to be an ISERROR or NULL check in PLEG…or am I missing it.
I will add this to the list to address.
Hi Richard,
Did you manage to make any progress on this ?
This is also now manifesting itself when a device loses its configuration (thanks to Vera) and needs to be re-configured. The PLEG routine tries to work as normal but fails as the device is no longer present, or has the incorrect attributes (or dead battery). Whilst I appreciate these circumstances are nothing to do with PLEG, it would be even better if PLEG was able to error check itself on its Condition. e.g. if this condition produces an error, then do this instead (ISERROR, NULL check)
…or perhaps there’s a way around it with another PLEG routine to check if the main routine fails with a startup error, then do this instead ?
Thanks mate
I too am interested as to how this will be addressed; I had raised a similar null concern in relations to a smart switch Watt measurement that PLEG see as a nill whereas the device shows a zero. see [url=http://forum.micasaverde.com/index.php/topic,34208.msg253943.html#msg253943]http://forum.micasaverde.com/index.php/topic,34208.msg253943.html#msg253943[/url], I’ve since employed a different solution due to no response as to a workaround. Mike