COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: kvchowdary on 30 Jun 2016 02:25:52 AM

Title: Sorting based on the user selection in promptpage
Post by: kvchowdary on 30 Jun 2016 02:25:52 AM
Hi,

I have a value prompt  to display products,if my user selects 10 products after that my user wants an option like Ascending,Descending

After selecting the products from the prompt,if he clicks on ascending,it should shows in ascending

env:Cognos10.2
Thanks
Title: Re: Sorting based on the user selection in promptpage
Post by: HalfBloodPrince on 30 Jun 2016 02:41:56 AM
what exactly you want to sort product names asc /desc or any amount like price for the product ??
Title: Re: Sorting based on the user selection in promptpage
Post by: kvchowdary on 30 Jun 2016 02:46:48 AM
Hi

Thanks for your reply

If my user selects 5 products from the prompt and he wants another prompt like ascending/desc,after selecting products if he clicks on ascending in the product prompt itself it should show as asc
Title: Re: Sorting based on the user selection in promptpage
Post by: hespora on 30 Jun 2016 03:26:51 AM
In your Prompt page, add:

- 1 value prompt, create new Parameter "pSort", don't create filter, don't create query. In its properties, add static choices ASC and DESC (exactly!), change Select UI to radio button group, add default selection ASC.

- 1 value prompt for your data item you want the user to do his selection on.

- 1 prompt button, in its properties change Type to Reprompt. 

in your query for the actual prompt, add a data item "Sort":

Rank([YourFieldGoesHere] #prompt('pSort','token')#)

Go back to your prompt page, and in the properties for your actual value filter, select your data item "Sort".

/edit: as far as I can tell, this *only* works on a relational datasource. Rank function seems to work differently on dimensional.
Title: Re: Sorting based on the user selection in promptpage
Post by: cognos-t on 30 Jun 2016 03:48:56 AM
Alternativly you can work with conditional blocks. The first 3 steps are similar to hespora's solution.

Place a conditional block on your report page and link your parameter "pSort" to this block. Put your lists in the block and sort them accordingly.

Best regards