COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: dipstm on 25 Mar 2008 10:03:41 AM

Title: Regarding Filtering data using Value prompts
Post by: dipstm on 25 Mar 2008 10:03:41 AM
Hi,
I have a list report with 5 columns( Col1,Col2,Grand Total,Min,Max). I want to introduce a value prompt such that it has 3 options in the drop-down viz., Min,Max and All.When the option Min is selected from the drop-down then only those records for which Grand Total < Min should be displayed.Similarly when Max option is chosen, only those records for which Grand Total > Max shld be displayed. For All option, all the records shld be displayed.

Plz provide me with a workaround for this.
Thanx,
Dipsy
Title: Re: Regarding Filtering data using Value prompts
Post by: almeids on 25 Mar 2008 11:38:57 AM
Static list in prompt with conditional filter:
(?prompt?='Min' and [grandtotal]<[min]) or (?prompt?='Max' and [grandtotal]>[max]) or (?prompt?='All')
Title: Re: Regarding Filtering data using Value prompts
Post by: dipstm on 26 Mar 2008 01:31:22 AM
Hi,
I tried your solution but I was not able to achieve the desired output.
The records in the list are not getting filtered.

Thanx,
Dipstm
Title: Re: Regarding Filtering data using Value prompts
Post by: almeids on 26 Mar 2008 07:41:24 AM
Something wrong with your filter expression.  Post it so we can take a look.
Title: Re: Regarding Filtering data using Value prompts
Post by: dipstm on 26 Mar 2008 08:30:44 AM


Hi,
I had created a value prompt with satic choices as follows:-
0 ( Use Value)  Minimum(Display Value)
1 ( Use Value)  Maximum(Display Value)
2 ( Use Value)  All( Display Value)

parameter name for the prompt was p_qty and the filter expression was as follows:-

(?p_qty?= 0 and [Grand Total]<[Overall Min]) or (?p_qty?= 1  and [Grand Total]>[Overall Max]) or (?p_qty?= 2 )

Plz let me knw if I am doing somthing wrong.

Thanx,
Dipstm
Title: Re: Regarding Filtering data using Value prompts
Post by: jamesqi on 26 Mar 2008 11:02:11 AM
Almeids,

I tried it too. It was not working. But when I changed to the following expression, it worked. This idea is really good. Thank you.

case ?Prompt?
when 'Min' then ([grandtotal]<[min])
when 'Max' then ([grandtotal]>[max])
else (1 = 1)
end
Title: Re: Regarding Filtering data using Value prompts
Post by: almeids on 26 Mar 2008 01:43:52 PM
Dipstm-
I think that prompts always return string values.  Try '0' instead of 0, etc.  (or better still, actual strings!)

Jamesqi-
I'm surprised that works, it's either something new in C8 or you got lucky.  While CASE statements work OK for expressions in calculated data items, I'd be careful with using them in filters where the OR contruct seems to be safer.