COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: pimogo on 08 Apr 2011 12:13:46 PM

Title: Render Variable expression not validating when no data
Post by: pimogo on 08 Apr 2011 12:13:46 PM
What's the best way to handle variable expressions that fail when no data is returned from the database?

The boolean expression i'm using [Month].[DiscountCheck]>0 works fine most of the time, but occasionally i get a RSV-RND-0089 Failed to evaluate expression: '[qDetail_Month].[DiscountCheck]>0'. error when no data is returned.

This expression is driving a render variable on a column to toggle it off and on.

Many thanks!


Title: Re: Render Variable expression not validating when no data
Post by: jcrouch on 08 Apr 2011 02:00:46 PM
Hi,

I think using a function that returns a default value for null values will help you. Try:

coalesce([Month].[DiscountCheck], 0)>0

Im not sure what database type you are using, but this should work for SQL at least. If not post here what type of DB you are using and Im sure there is an equivilent function for it.
Title: Re: Render Variable expression not validating when no data
Post by: Lynn on 08 Apr 2011 03:20:06 PM
I tried to replicate your problem but I don't get an error when the result set is empty. I am on version 8.4.1

Did the coalesce idea work? My first thought was that it would still need a result set returned with a null value in order to coalesce it. Of course I am quite likely wrong and couldn't replicate the problem to see  :P

Do you have "No Data Contents" defined for your list (assuming we're talking about a list)? Maybe that might help you out?
Title: Re: Render Variable expression not validating when no data
Post by: pimogo on 11 Apr 2011 06:26:38 PM
Actually i stilll got the same error after trying Coalesce.

Makes sense as colesce still requires there to be data.  One to keep in mind is that the expression above is going against one of the queries. So if the expression is being evaluated at that level, will "No data content" setting have any effect on the conditional expression? 

i wonder if there is a way to evaluate # of rows brought back.
Title: Re: Render Variable expression not validating when no data
Post by: mrcool on 11 Apr 2011 08:00:58 PM
Hi,

Why is the name different in the error to the expression used in the boolean variable?


Cheers,
Mrcool
Title: Re: Render Variable expression not validating when no data
Post by: ShwetalM on 12 Apr 2011 01:54:25 AM
Not sure if this will help...but worth a try...since you're variable expression is based on query item...
1.)try associating that query with page or
2.) if the data item in variable expression is sourced from same query that's associated with your target list object....click the properties for List and check the data item used in the expression...