Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have a problem. I have in my script a field Month which has number's months (1,2,3,4,5,6,...,12).
I don't have a date field and I want to convert the number's months in text (Jan, Feb, Mar,Apr, Jul,..., Dic).
How can I make it?
Please, it's important.
Thanks.
Month(MakeDate(0,MonthNum)) as Month
Hi,
Use Inline table
try like
load * INLINE[
Month,MonthName
1,Jan
2,Feb
...
..
];
Regards
Month(MakeDate(0,MonthNum)) as Month
SubField('$(MonthNames)',';',MonthNumberField) as MonthNameField
Recommend to always convert partial dates into real dates and then to use QV's built-in logic and functions to handle in a formatted way.
So you may create a field with eg
MAKEDATE(1, MonthNum, Year) AS Date
HTH Peter
Hi,
Try this
DateNum:
LOAD * Inline
[
DaNUM
1
2
3
4
5
6
7
8
9
10
11
12
];
FOR i =0 to NoOfRows('DateNum') - 1
LET vMonthName =Peek('DaNUM',$(i),'DateNum');
Final:
LOAD
'$(vMonthName)' AS Month_Num
,MonthName(MakeDate(Date(Year(TODAY()),'YYYY'),$(vMonthName))) AS MonthName
Resident DateNum;
NEXT i
DROP Table DateNum;
Thanks a lot! It's what I wanted. In this way I have no problem to order the new field MonthName.