COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: sram007 on 24 Feb 2011 07:00:59 AM

Title: Dynamic Cloumn Sorting without JS
Post by: sram007 on 24 Feb 2011 07:00:59 AM
Hi ,
In my list report i have 4 colums like Column1,Column2,Column3,Column4.
& In my Value prompt  i had added the 4 column names  as satic choice,
When im selecting the Colum1 in value prompt,it sould be sorted descending ,like that i should able to sort the 4 colums,
i Want to achieve this without using  JavaScript can anyone please help me with the expression code..
Cheers,
Ram
Title: Re: Dynamic Cloumn Sorting without JS
Post by: Lynn on 24 Feb 2011 08:39:06 AM
You could try this:
When the report runs only one of the lists will render depending on the user's selection.
Title: Re: Dynamic Cloumn Sorting without JS
Post by: CognosPaul on 24 Feb 2011 08:58:22 AM
Another way:

Create a field in the query called SortKey. The expression should be:
#sb(prompt('promptchoice','token'))#

Sort your list by that field.

Make Column1 the default value for the prompt.

When the report runs SortKey will resolve to [Column1], and the list will sort based on that. When the user selects another field, Column2 for instance, the macro will resolve to [Column2].
Title: Re: Dynamic Cloumn Sorting without JS
Post by: Lynn on 24 Feb 2011 09:03:19 AM
Quote from: PaulM on 24 Feb 2011 08:58:22 AM
Another way:

Create a field in the query called SortKey. The expression should be:
#sb(prompt('promptchoice','token'))#

Sort your list by that field.

Make Column1 the default value for the prompt.

When the report runs SortKey will resolve to [Column1], and the list will sort based on that. When the user selects another field, Column2 for instance, the macro will resolve to [Column2].


SOOOO much better!!
Title: Re: Dynamic Cloumn Sorting without JS
Post by: PRIT AMRIT on 24 Feb 2011 10:29:56 PM
Amazing ..
Title: Re: Dynamic Cloumn Sorting without JS
Post by: sram007 on 28 Feb 2011 04:52:19 AM
Thanks for your reply guys ..
Regards,
Ram