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 data in a specific way

Started by philelmousse, 02 Feb 2011 04:26:31 AM

Previous topic - Next topic

philelmousse

Hello, how to sort a column not in alphabetical way ?

MFGF

How do you want it to be sorted?
Meep!

jive

#2
Hi Phil,
For sorting data you will need a column, if you don't have it in your model you need to build it a report time. Like

data item: sort_col2
case [some_data].[data_itself]
   when 'A' then 4
   when 'B' then 3
   when 'C' then 1
  when  'D' then 2
  else 5
end
That way when you sort your data by the column sort_col2 it will be on the order you need. put the data item at the end of your list or crosstab and chose the properties "Box type" and select non, the column will be hidden.
One other thing is when you build your model, it's a good thing to always leave a column for sorting in a special way, by that a mean other sort then alphabetical or numeric.

philelmousse

i add a "sorting column" with number (1,2,3,4) in my list and make the sort with that column. I delete that column to try and it still sorted. Thats normal ?

jive

Did you delete or hide the column, if you delete i'm not sure how many it will stay in that order, but if you hide the column it will stay.

Regards Jacques

RobsWalker68

#5
Hi,

In your report click on the Query Explorer tab and add an item to your query to create your sort order e.g. using the Go Sales (Query) example:

Case
When [Product line] = 'Camping Equipment' then '5'
When [Product line] = 'Golf Equipment' then '1'
When [Product line] = 'Mountaineering Equipment' then '2'
When [Product line] = 'Outdoor Protection' then '3'
When [Product line] = 'Personal Accessories' then '4'
end

Click on your page and then using the ancestor button choose your object e.g. List.  In its properties click on the ellipsis next to Grouping and Sorting and add the sort data item created above to the detail sort list.  This way you do not need to add it to your actual layout.

Kind Regards

Rob

philelmousse

thanks a lot Rob, really good to know  :)