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

Dynamic Sorting on List Columns

Started by praveenb77, 19 Mar 2014 02:48:32 PM

Previous topic - Next topic

praveenb77

Hi,

I have to implement the dynamic sort on the list columns in a report. I have ample of scripts available on net but, nothing is working perfect. I have attached the script which is written by ibm folks in which i can apply the sort on the report intitial load ( when i do page down, sort is not working ).

Do anyone have a working script for the dynamic sorting functionality ?

Thanks!

navissar

There are two types of dynamic sort solutions for lists in Cognos.
1. Dynamic sort scripts that use JS to do the entire sorting - these run through all the items in the list and sort them. for these to work, your list cannot paginate.
These will work quickly on small datasets,but will perform terribly with long lists. See example here: http://www.cognosonsteroids.com/2012/04/sort-list-report-dynamically-using.html
2. Scripts that identify the selected column, give it to a sort parameter and reprompt the report. You should be after this kind if your list is long.
See here http://www.ibm.com/developerworks/data/library/cognos/reporting/scripting_techniques/page515.html

Ammus1234

I have done something similar based on Prompt API + hidden prompt+calculated query item in the past.

Requirement was when the user clicks on the heading of the column, the report should retrieve top 10 records based on that column. I did it by placing an html on each title of the column and setting the value of a hidden prompt onclick. Based on the prompt value, the query will change and fetch the top 10.  :)
It was working perfectly in that case, as I wanted the full list to be refreshed every time and fetch the top 10. Also it was a dimensional reporting.

Hope this will help.

praveenb77

Nimrod,

For the first type you have provided, the sorting is working fine only for String values but not for Numeric values.

Can you please help.

Thanks!

navissar

It isn't my custom to support other people's scripts. The script is definitely not a script which "I provided".
If I may, I also feel that commenting on a 2013 thread on top of opening this one is a bit of a forum abuse.
Also, it is quite clear to me that since you're paginating your list as is clear in your first message, that is probably why your scripts fail.

Having said that, I'm guessing by a quick browse through the code the reason it doesn't properly sort numeric is because of formats (commas and periods and such). You can use regular expressions to remove these.