Handling formula errors in Web Intelligence

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.

Lets 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:

Lets assume x = 6 and y = 0

IF (IsError(x/y);”The y object is zero – a DIV/0 error has occured”;(x/y))

In this example, the statement x/y is being evaluated within the IsError function:

6/0

As you can’t divide by zero, a DIV/0 error has occured 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 y object is zero – a DIV/0 error has occured”

If we change the y value to 3, the IsError function returns 0 – no error, and the second part of the IF statement is evaluated: x/y – which gives us a value of 2.

It is good practice to include error handling into your reports, particularly when you are performing any type of division task. 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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: