Evaluates an expression and returns a constant number or string if the expression returns an error.

Usage:

ErrorMask (e,v)

Parameters

e - Any valid formula expression, including functions, equations and question references.
v - A numeric or string value to be returned if an error is generated by evaluating the first parameter.
 
The expression in the first parameter can be as simple as a single question reference, such as [q1] or a full calculation such as [q1] + [q2]/[q3]. In any event, the ErrorMask function simply checks that the final result of its first parameter is numeric. If it’s not numeric, it deems it to be an error.

Examples

Adding a total of calculated values:
 
This example takes a series of values and does calculations using those values. Each value is retrieved from a different user prompt question.
 
The final formula used to total each of the three values would be as follows:
 
ErrorMask([q1] + [q2] + [q3], 0)
 
If the values entered were 1, 2 and 3 respectively, the output will be 6
 
If the values entered were 1, 2 and A respectively, the output will be 0
 
Let the final formula used to total each of the three values would be as follows: [q1] + [q2] + ErrorMask([q3]/1, 0)
 
If the values entered were 1, 2 and 3 respectively, the output will be 6
 
If the values entered were 1, 2 and A respectively, the output will be 3
 
The parameters passed in ([q1] [q2] [q3]) references  answers containing the variable formulas that in turn refer to each of the user prompt questions. 0 Replace a non-numeric value returned from the first parameter with a 0, so that it doesn’t impact the addition operations.

Notes

A string value can also be returned if an expression returns an error. Eg: ErrorMask([q1]+[q2]+[q3], “Non-numeric values can’t be added”) 1.The first parameter in an ErrorMask function should always be an expression. Eg: ErrorMask([q3], 0) – Wrong ErrorMask([q3]/1, 0) – Correct

Related Articles

error catch errormask mask masking replace