COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: rprameshwor on 02 Apr 2013 02:30:12 AM

Title: Dynamic sort on two columns
Post by: rprameshwor on 02 Apr 2013 02:30:12 AM
My requirement is to let the user  sort the items in the list .
The sorting is based on two columns , and ASC/DSC on both. [ Clicking on Header/list  preferred rather than making prompts ]
eg:-

Division | Depart | Quantity
A                1              #
A                2              #
B                1              #
C                2              #

The user should be allowed to  sort by Division first then Depart   
eg:- [ in both ASC ]


Division | Depart | Quantity
A                1              #
A                2              #
B                1              #
C                2              #

or even Depart ASC first then Div DESC.
eg :-

Division | Depart | Quantity
B                1              #
A                1              #
C                2              #
A                2              #

So, user should be allowed to sort asc/dsc on both div/department  and sort by both of them . one of them first then other the second.
Anyways i can accomplish this in ReportStudio ?

Thanks in advance.
Title: Re: Dynamic sort on two columns
Post by: Lynn on 02 Apr 2013 10:14:38 AM
Attached is a document I wrote about how to achieve this for one column using a drill through to the same report. Not sure how easily adaptable it might be for two columns but perhaps it might stimulate some ideas for you to play around with.
Title: Re: Dynamic sort on two columns
Post by: sthabinash on 03 Apr 2013 03:58:59 AM
Quote from: rprameshwor on 02 Apr 2013 02:30:12 AM
My requirement is to let the user  sort the items in the list .
The sorting is based on two columns , and ASC/DSC on both. [ Clicking on Header/list  preferred rather than making prompts ]
eg:-

Division | Depart | Quantity
A                1              #
A                2              #
B                1              #
C                2              #

The user should be allowed to  sort by Division first then Depart   
eg:- [ in both ASC ]


Division | Depart | Quantity
A                1              #
A                2              #
B                1              #
C                2              #

or even Depart ASC first then Div DESC.
eg :-

Division | Depart | Quantity
B                1              #
A                1              #
C                2              #
A                2              #

So, user should be allowed to sort asc/dsc on both div/department  and sort by both of them . one of them first then other the second.
Anyways i can accomplish this in ReportStudio ?

Thanks in advance.



You can achieve this by creating 4 prompts and 4 data items. 2 prompts are for the first sorting field and second sorting field. And the remaining fields are for the type of sorting i.e.(Ascending and Descending). Each data item stores the data for each combination of the two prompts (i.e. the field and the sort type). Then you can select the data item you require and sort it based on the data item you want using the grouping and sorting option of the list.

If this works for you (as this is based on the prompts and not click on the header), I can describe it in detail.
Title: Re: Dynamic sort on two columns
Post by: rprameshwor on 03 Apr 2013 05:46:01 AM
Could you please elaborate a little
Title: Re: Dynamic sort on two columns
Post by: sthabinash on 04 Apr 2013 02:49:45 AM
For sorting through two columns can be done by following these steps.


This will give you the report for sorting.