COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: nonvolatile16 on 16 Feb 2014 08:41:13 PM

Title: How to sort list column using prompt value
Post by: nonvolatile16 on 16 Feb 2014 08:41:13 PM
Hello, I'm a newbie for report studio and need help, please.

I want to select sorting by value prompt.

Assume that I have a list which contained columns of Product Type, Product, and Revenues

(the Product Type and Product columns are level while the Revenues is measure) 

There are 2 value prompts, one to choose which column (one of those 3 columns ) to sort and the another for sort type like ascending or descending

What should I do? and I can't find any expression to define ascending or descending sort.

Thank you.
Title: Re: How to sort list column using prompt value
Post by: mitwa on 17 Feb 2014 08:45:00 AM
Hi,

1. create value prompt as asc/dsc.
2. here m assuming sorting on product line, create 2 data item for product line itself, one is in ascending order and another is of descending order then try to hide each using style variable.
2. create style variable as
                                                 case when ParamDisplayValue('asc/dsc')='asc' then 'show' else 'hide'
                                                   end
Title: Re: How to sort list column using prompt value
Post by: ry1633 on 26 Jun 2015 02:58:01 PM
I think I noticed something with the original CASE statement and setup that is wrong and I think it's my fault.   I have it setup this way:

CASE
WHEN [ESTABLISHMENT] contains '189E'
THEN [ESTABLISHMENT]
ELSE NULL
END
Aggregate Function:  Count,  and Aggregate Rollup:  Count Distinct

Problem is that the summations at the end are wrong.  It only works right when I select all the values for the report.   But when I filter by [PRODUCT] which is a different field than the totals don't work right

In the bottom header I have:

Data Item2: (subtotal):  COUNT(ESTABLISHMENT)

Data Item3:  CASE statement for 189 establishments

Data Item4 (total): [Data Item2] - [Data Item3]