If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Conditional Filter in Report Studio

Started by reginoilano, 08 Apr 2010 03:38:12 AM

Previous topic - Next topic

reginoilano

Hi,

I have a conditional filter in a report where in they can choose if they would like to see Zero values for a certain measure. but once I run the report specially when they don't want to see Zero amount an error occured stating that it is a wrong expression type

the code is:

If (?Prompt Display Zero Amount? = 'Yes') Then
([Amount])
Else
(([Amount]) > 0)

anyone have tried this?

MFGF

Hi,

I'm a little confused by the syntax you are using here, so I'm not surprised Cognos 8 is returning an Expression Type error.

Assuming this is a filter not a calculation, it doesn't make sense, as the two returned filter expressions possible are either

[Amount]

or

[Amount] > 0

The latter looks to be OK, but the former is not a filter expression.

The expression wouldn't make sense in a calculation either, as [Amount] > 0 does not return a calculated value.


I would amend the filter to be something like:

If (?Prompt Display Zero Amount? = 'Yes') Then
([Amount] is not null)
Else
([Amount] > 0)

Both of the returned expressions are now valid filters, so hopefully should return desired results.

Regards,

MF.
Meep!

reginoilano

Thanks!

I did make a mistake for that conditional filter, now it's working!  :)

cognos4all

#3
i have a report where i want to do the conditional filter but i am getting error when i try to do similar like this.
I have a report with optional date prompt, When i run the report first time i want to run the report for last 15 days (this is the dafault), but when the user select the data range from the date prompt then i want to apply selected date as filter instead of default date filter. I am using date prompt control in the report.

i tried this and didn't worked. What am i doing wrong.

If (  ?SelectedDateRange? is not missing  ) then
[Date] in_range ?SelectedDateRange?
else
[Date] >=  _add_days (current_date , -15)

MFGF

What error is returned when you do this?
Meep!

pratyush

Quote from: reginoilano on 08 Apr 2010 03:38:12 AM
Hi,

I have a conditional filter in a report where in they can choose if they would like to see Zero values for a certain measure. but once I run the report specially when they don't want to see Zero amount an error occured stating that it is a wrong expression type

the code is:

If (?Prompt Display Zero Amount? = 'Yes') Then
([Amount])
Else
(([Amount]) > 0)

anyone have tried this?


Hi

You must be either using list or crosstab for the same, you need to check the dataitem [Amount] under the properties of either list or crosstab ...

Cheers ..........