Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi to everyone,
I'm trying to use master calendar created using this script:
QuartersMap:
MAPPING LOAD
rowno() as Month,
'Q' & Ceil (rowno()/3) as Quarter
AUTOGENERATE (12);
Temp:
Load
min([create_time]) as minDate,
max([create_time]) as maxDate
Resident ticket;
Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));
DROP Table Temp;
TempCalendar:
LOAD
$(varMinDate) + IterNo()- 1 As Num,
$(varMinDate) + IterNo() - 1 as TempDate
AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);
MasterCalendar:
Load
TempDate AS GlobalDate,
Date(TempDate, 'DD/MM/YYYY') AS CalendarDate,
week(TempDate) As Week,
Year(TempDate) As Year,
Year(TempDate) & '-' & Month(TempDate) as YearMonth,
Month(TempDate) As Month,
Day(TempDate) As Day,
Year(TempDate) & '-' & ApplyMap('QuartersMap', month(TempDate), Null()) as YearQuarter,
Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as YearWeek,
WeekDay(TempDate) as WeekDay
Resident TempCalendar
Order By TempDate ASC;
Drop Table TempCalendar;
When load data I obtain the following error message....I cannot understand why the ',' is wrongly considered as an operator and how fix it....
Hi,
As to my understanding, the lines:
Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));
May not be returning anything, so the next load is getting an error.
Can you check that both variables have values please?
I've tested the script here:
dummy:
load * Inline
[
type,value,data
red,100,01/01/2019
green,200,02/01/2019
blue,300,03/01/2019
];
QuartersMap:
MAPPING LOAD
rowno() as Month,
'Q' & Ceil (rowno()/3) as Quarter
AUTOGENERATE (12);
Temp:
Load
min(data) as minDate,
max(data) as maxDate
Resident dummy;
Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));
DROP Table Temp;
TempCalendar:
LOAD
$(varMinDate) + IterNo()- 1 As Num,
$(varMinDate) + IterNo() - 1 as TempDate
AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);
MasterCalendar:
Load
TempDate AS GlobalDate,
Date(TempDate, 'DD/MM/YYYY') AS CalendarDate,
week(TempDate) As Week,
Year(TempDate) As Year,
Year(TempDate) & '-' & Month(TempDate) as YearMonth,
Month(TempDate) As Month,
Day(TempDate) As Day,
Year(TempDate) & '-' & ApplyMap('QuartersMap', month(TempDate), Null()) as YearQuarter,
Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as YearWeek,
WeekDay(TempDate) as WeekDay
Resident TempCalendar
Order By TempDate ASC;
Drop Table TempCalendar;
and went like a charm.
Hi Felipedl,
thanks for you answer.
In my ticket table I have create_time with values...