Sort months

Is there a way of sorting a attribute containing monthnames ( to_char( xxx, ‘MONTH’) ) by month and not alfabetically? Now I have a report with two netsed sections only to have month, one in month number and on in month name. There must be a nice trick for this…

hans

************************************************************* Hans Kingma
Unisource Carrier Services
Industriestrasse 21
8304 Wallisellen
Switzerland
Phone: +41 1 839 32 11
Fax: +41 1 839 32 95


Listserv Archives (BOB member since 2002-06-25)

hans.kingma@UNISOURCE-UCS.COM wrote:

Is there a way of sorting a attribute containing monthnames ( to_char( xxx, ‘MONTH’) ) by month and not alfabetically? Now I have a report with two netsed sections only to have month, one in month number and on in month name. There must be a nice trick for this…

hans

yes, certainly:

Click on the field you want to sort, go to the Format menu and select sorts. You’ll see a radio button under a heading sort definiton. Choose custom. Now you can sort them any way you want.

Desiree Schipper
Information Manager
Erasmus University Rotterdam


Listserv Archives (BOB member since 2002-06-25)

Hans,

Is there a way of sorting a attribute containing
monthnames .…There must be a nice trick for this…

Assuming you are using >4.1 then look at the ‘Custom Sort’ option in your manuals or the on-line help. As a pointer, its under the 'Format - Sorts ’ menu item. Add a sort then use the ‘Custom Sort’ option under the ‘Sort Definition’ group.

Regards,

Jonathan

Project Leader
Group Medical, Regulatory and Product Strategy IS


Listserv Archives (BOB member since 2002-06-25)

Hans wrote:

<<Is there a way of sorting a attribute containing monthnames ( to_char( xxx, ‘MONTH’) ) by month and not alfabetically?>>

If the attribute is a date type, then you can display the month name using the proper format (i.e. “Mmm”) and still sort on it chronologically. If you only have the month as a number type, then you can create an object that is a date type by applying the ToDate function. Hope this addresses your issue.

_______________________________________________________ Andy Oliver
CP&L - Financial Systems
andrew.oliver@cplc.com


Listserv Archives (BOB member since 2002-06-25)

Hans wrote:

<<Is there a way of sorting a attribute containing monthnames ( to_char( >xxx,
‘MONTH’) ) by month and not alfabetically?>>

Easiest way I know to do this is to create a variable that assigns a new ‘sort value’ i.e. if month = ‘Jan’ then 1 else if month = ‘Feb’ then 2, etc. Then sort on the new variable, which you can hide in the table.

Jason Beard
AGD Consulting


Listserv Archives (BOB member since 2002-06-25)

Thanks for the suggestion. I didn’t know there was something like that. But… the sort (by month) is wrong! It sorts September before August! So in the sorted list I currently have

SEPTEMBER
AUGUST
OCTOBER

Upper case is coming from our Oracle database (to_char( , “MONTH”) function. Maybe that is causing the problem? Ofcourse I can still sort them by hand…

hans

Click on the field you want to sort, go to the Format menu and select sorts.
You’ll see a radio button under a heading sort definiton. Choose custom. Now you
can sort them any way you want.

Desiree Schipper


Listserv Archives (BOB member since 2002-06-25)

Is there a way of sorting a attribute containing monthnames ( to_char(xxx, ‘MONTH’) ) by month and not alfabetically? Now I have a report with two netsed sections only to have month, one in month number and on in month name. There must be a nice trick for this…

hans

Hi Hans,

I tend to deal with this using the alerter function. by adding an alerter which converts numeric month-indication to text, you will still find that sorting on the column is based on the original, numeric values, and not on the text strings.

by the way, I usually work with 4 alerters – 1 for each quarter – since BO allows you to define only 5 values to be converted per alerter.

you can avoid defining the alerters for each and every report you create, by saving them in a template: in this way you will always have your alerters at hand when you need them!

good luck,
mirko


Listserv Archives (BOB member since 2002-06-25)