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

Sort Parameter Values on Report Page

Started by nishithshri, 13 Mar 2017 01:21:28 PM

Previous topic - Next topic

nishithshri

I have a multi select prompt in the report page which is sorted descending. I am displaying parameter values that are selected in the prompt at the title of my report (paramdisplayvalue). I want paramdisplayvalues in the title of the report to be sorted as ascending. I have tried a few options but it did not work so far !!

Any help would be appreciated !!

AnalyticsWithJay

Here you go:


#sq(csv(sort(split(';', promptmany('ParameterName', 'string'))), ',', ''))#


From the inner most function:
1. Get the prompt values.
2. We need to construct an array before we can sort. The values are separated by a semi-colon.
3. Sort.
4. Return the sorted values, comma separated.
5. Encapsulate in single quotes to display a final string.

Macro-functions can be very powerful if you get comfortable with using them.

nishithshri

Hello CognoidJay, this works great. I created a data item and used it in place of paramdisplayvalues and it worked like a charm. Thank you very much. However is it possible to get the string without single quotes. Currently i am getting it as: 'a','b','c' and i want it as: a, b, c.

nishithshri

I spoke too soon. I tried replace function on the macro and it gave what i wanted. Thanks again for your help, CognoidJay. I am not into macros much but should learn more about it.

AnalyticsWithJay

Quote from: nishithshri on 14 Mar 2017 12:03:10 PM
I spoke too soon. I tried replace function on the macro and it gave what i wanted. Thanks again for your help, CognoidJay. I am not into macros much but should learn more about it.

Great to hear  :). Macros have been underutilized because they were only visible in FM for the longest time.

Cheers,
Jay