Math Functions: Errors Calculator
Math Functions: Errors
There are two kinds of errors, syntax and calculation. A syntax error occurs when an equation is formed in a way PowerOne doesn't understand. When a syntax error occurs, an error alert is displayed in the lower, left corner and each equation with an error shows an error button. Syntax errors are discussed in [https://.../t/help_equations|Equations].
Calculation errors occur when the result of a computation fails. When a calculation error occurs, the error is displayed next to the variable that was impacted. Calculation errors are discussed in [https://.../t/help_variables|Variables].
In addition, errors can be avoided by validating data. A message can be displayed to the template user.
__This function is only available in templates.__
Error
++error("description")++
Displays the error text 'description'. 'description' must be surrounded by quotation marks (") or will return 'Missing "' calculation error. Generally error() function is used in if statements.
**Internal Error Codes**
You can also access the internal error codes used by PowerOne. For each error, replace "description" with the following:
- "NaN" : not a number
- "posInfinity" : positive infinity
- "negInfinity" : negative infinity
- "divZero" : division by zero
- "noAnswer" : no answer
**Examples**
= 0"; sqrt(x))>
[https://.../t/79d233ecb8b5acfb9549|Probabilities]
Validations
++validate(conditional; "true statement")++
Validate will check data as entered in the template. 'conditional' is any comparison the same as an [https://.../t/help_functions_if | if statement]. You can use ==, <, >, <>, <=, >= as well as and (&&), or (||), and not (!). 'true statement' is text (in quotes) to display if the validation proves true. Validate methods can be added anywhere, either by creating their own equations or by stringing them together in a single equation. The validate() function returns a string variable, whether the provided text or, if no error occurs, an empty string. Examples:
Alternatively, you can:
In the first scenario, the validation will trigger for each entered value, A and B, independently. In the second scenario, the validation won’t trigger until both A and B have been entered.
Furthermore, as mentioned, the output is a string, which means the result will display in the template itself unless marked as **hidden** in **details**.
**Examples**
[https://.../t/e1c94d7735d61ad2ec1d | Post Holes]
[https://.../t/aa0423d576bba122d865 | Conductor Size]
[https://.../t/f559f004c9761f601165 | Fault Current]
[https://.../t/483de92c04d11afd839d | Battery Size]
[https://.../t/2ad1674d391ff15fd61f | Grounding Electrode]
[https://.../t/eecef50973846d0c7713 | Minimum Burial Depth]
[https://.../t/77376c1cdf2f9190f959 | Voltage Drop]
Keywords
-------------
NaN
posInfinity
negInfinity
divZero
noAnswer
error()