Allow BadVal to check multiple inputs or IFERROR
Right now BadVal can only check one variable or Expression. So if I am evaluating an expression with say 10 inputs, and I want the expression to output NoOutput() if any one of the 10 inputs are BadVal, then I have 2 options right now.
1) copy the whole expression into the BadVal funtion and do "if badval(expression) then NoOutput() Else expression".
2) Do "if (BadVal(input1) or BadVal(input2) or ...) then NoOutput() else expression".
Ideally you would have a IFERROR function like in Excel. So you would just type "IFERROR(expression,NoOutput())
Alternatively you could have BadVal allow multuple inputes. So "If BadVal(input1,input2,input2,...) then NoOutput() else expression"
I'm sure one of these options is more resource efficient then the currently available options.
Is there any movement on this? Because as of right now I'm not seeing a clear way to defend against all of the error types for analysis that have multiple inputs. Having an analysis just blanket evaluate to 'Calculation Failure' from a bad value from one of many tags means writing the same defensive statement for every tag and every instance. Couple that with the analysis "IDE" window in AF System explorer that is like 2 inches wide and not expandable just makes for a less than desirable experience.
I just tried this with the latest release:
BadVal(1/0) and that returns True
What is your desired behavior with BadVal(1/0)?
Simon J. Dyson commented
IFERROR equivalent functionality would make validation and formula simpler. Or better still BadVal should work as you would expect. E.g. why doesnt a divide by zero error get picked up by BadVal?
Jacques Vosloo commented
+1 for IFERROR function
Mike Horrocks commented
Rather than the listed Option 1 (copy the whole expression...) it would be possible to execute that expression and instead of outputting the result use it as a variable where you could then do:
If BadVal(VariableName) Then NoOutput() Else VariableName
This would prevent the expression being executed twice.
+1 for IFERROR function as it would greatly simplify handling bad data and expressions.