If you are unable to create a new account, please email bspsoftware@techdata.com

Author Topic: Sorting by month name, with numeric column.  (Read 1185 times)

Offline shark1986

  • Full Member
  • ***
  • Join Date: Mar 2022
  • Posts: 10
  • Forum Citizenship: +0/-0
Sorting by month name, with numeric column.
« on: 25 Mar 2022 09:16:45 am »
Hi guys, I need some help. I have a month field that is made up of numbers. My client wants to see the filter by month name.
I made a new query using Case Month = 1 Then 'Jan' and so on.
But when I go to Cognos Analytics and ask to sort, it sorts by Alphabetical order and not by month number.
Is there anything that can be done to sort by month number in this case?
I'm using Cognos version 11.0.11.

Offline dougp

  • Statesman
  • ******
  • Join Date: Jul 2014
  • Posts: 862
  • Forum Citizenship: +30/-1
Re: Sorting by month name, with numeric column.
« Reply #1 on: 25 Mar 2022 12:43:28 pm »
Yes.

What are you trying to sort.  Is this a list, a crosstab, a value prompt,...?

Offline shark1986

  • Full Member
  • ***
  • Join Date: Mar 2022
  • Posts: 10
  • Forum Citizenship: +0/-0
Re: Sorting by month name, with numeric column.
« Reply #2 on: 28 Mar 2022 04:04:37 pm »
One list. I would need it to sort by month value (1,2,3,4,5) but that the name of the month appear (January, February, March, April, May).

In short, I wanted it to be sorted by the number of months, but the name of the month would appear in the list.


Offline MFGF

  • Never knowingly correct
  • Super Moderator
  • Statesman
  • ******
  • Join Date: Jul 2005
  • Posts: 11,635
  • Forum Citizenship: +676/-10
  • Cognos Software Muppet
Re: Sorting by month name, with numeric column.
« Reply #3 on: 29 Mar 2022 07:35:03 am »
One list. I would need it to sort by month value (1,2,3,4,5) but that the name of the month appear (January, February, March, April, May).

In short, I wanted it to be sorted by the number of months, but the name of the month would appear in the list.

Hi,

The trick here is to include the Month Number in the query that drives the List, but don't actually show the Month Number in the List. You will probably need to add the Month Number as a property of the List object to ensure that it doesn't get ignored by the query engine - to do this, select the List object in your report, open the Properties pane, find the "Properties" property, and check the Month Number item. In your Sort, choose to sort on the Month Number item, and you should be fine.

Cheers!

MF.
Meep!