Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have a field which has all the month names arranged in almost alphabetical order .how to change it to the order starting from Jan to Dec?? CAn anyone please help me out??
Regards,
Sahana
Hi Sahana
Here is a solution you can use:
It just depends on what your month field looks like. For example, if your months are spelled out (January, February etc.) you will have to spell it out in the inline load below as well. Also keep in mind that QV is case sensitive so if your months are spelled JANUARY, you will have to use all caps below as well. Hope this helps.
Month_Rank:
LOAD * Inline [
[Your Month Field Name], MonthRank
JAN, 1
FEB, 2
MAR, 3
APR, 4
MAY, 5
JUN, 6
JUL, 7
AUG, 8
SEP, 9
OCT, 10
NOV, 11
DEC, 12
];
Just sort by MonthRank in ascending order.
Hi Ruhan,
Thanks for the response.
As you said I have given as shown below,but some syntax issue is there I guess,can you please help ??
Month_Rank:
LOAD * Inline
[xbasedelivmonth] ,MonthRank
JANUARY, 1
FEBRUARY, 2
MARCH, 3
APRIL, 4
MAY, 5
JUNE, 6
JULY, 7
AUGUST, 8
SEPTEMBER, 9
OCTOBER, 10
NOVEMBER, 11
DECEMBER, 12
;
load * Inline
[
[xbasedelivmonth] ,MonthRank
JANUARY, 1
FEBRUARY, 2
MARCH, 3
APRIL, 4
MAY, 5
JUNE, 6
JULY, 7
AUGUST, 8
SEPTEMBER, 9
OCTOBER, 10
NOVEMBER, 11
DECEMBER, 12
];
Month_Rank:
LOAD * Inline [
xbasedelivmonth ,MonthRank
JANUARY, 1
FEBRUARY, 2
MARCH, 3
APRIL, 4
MAY, 5
JUNE, 6
JULY, 7
AUGUST, 8
SEPTEMBER, 9
OCTOBER, 10
NOVEMBER, 11
DECEMBER, 12
];
You need to add square bracket in inline
Month_Rank:
LOAD * Inline [
[xbasedelivmonth] ,MonthRank
JANUARY, 1
FEBRUARY, 2
MARCH, 3
APRIL, 4
MAY, 5
JUNE, 6
JULY, 7
AUGUST, 8
SEPTEMBER, 9
OCTOBER, 10
NOVEMBER, 11
DECEMBER, 12
]
;
it still doesn't work
I have attached my file you can have a look in the script on tab 3.
try below,
newmonth:
load * Inline
[
xbasedelivmonth,MonthRank
JANUARY, 1
FEBRUARY, 2
MARCH, 3
APRIL, 4
MAY, 5
JUNE, 6
JULY, 7
AUGUST, 8
SEPTEMBER, 9
OCTOBER, 10
NOVEMBER, 11
DECEMBER, 12
];
Remove [ ] around - xbasedelivmonth
Juts Remove Brackets ([,])
fro the field [xbasedelivmonth] like xbasedelivmonth
or else
with out making it you can use match function in sort tab-->Expression
like match(xbasedelivmonth,'JAN','FEB','MAR'.........)