Don’t you just hate it when you see a report with DIV/0 errors? Thankfully, Web Intelligence provides us with a function to handle these types of errors, allowing us to provide a more meaningful message.
Let's look at IsError:
- IsError() is a function which will return a boolean value.
- A 1 is returned is the formula being evaluated is in error. A 0 if there is no error.
- This function is particularly useful when embedded into an IF statement.
Let's look into this with an example:
I’m going to create a variable in a WebI document called formula.
The value for this variable is =6/0.
If we use this variable in the report, we can see something that the picture below:
2. So now is when we can use the function mentioned above.
I create a new variable called IsError to manage this error.
As you can’t divide by zero, a DIV/0 error has occurred and a 1 is returned by the IsError statement.
The IF statement then presents one of two outcomes depending on this boolean value.
In the case of an error, the user is presented with some meaningful text:
“The denominator object is 0”
So if we use this new variable in the report, we can see something that the picture below:
As you can see, using the new variable IsError you can’t see the error message that we got with the variable formula.
3. Now, I’m going to change de value for the variable called formula as below:
The result that we get is the same for both variables:
As conclusion, it is good practice to include error handling into your reports, particularly when you are performing any type of division task.
For the user, it’s much better indicate an explanation of the displayed error that show only the message that WebI provides.
Wrapping an If IsError check around your formula ensures that these type of errors are handled in the correct manner and should help the user identify how the problem can be fixed.
You can manage other kind of error doing the same process.