Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Could I get two calendars out of two date fields separately?
Below is the code that I have used:
CODE:
/**********************
Basic Calendar using defaults
***********************/
// Get min/max values for calendar using "Date" field
CALL Qvc.GetFieldValues('vDate', 'Date', 'IncidentDetails');
// Build a Calendar with default name
CALL Qvc.Calendar(vDate.Min, vDate.Max, 'Fiscal Calendar', '', 4);
SET vDate.Min=;
SET vDate.Max=;
CALL Qvc.Cleanup;
RENAME Table [Fiscal Calendar] to Temp;
[Fiscal Calendar]:
LOAD *,Week(Date) as [Week]
Resident Temp;
DROP Table Temp;
/*******************************Calendar using Survey Date**************************************/
/**********************
Basic Calendar using defaults
***********************/
// Get min/max values for calendar using "Date" field
CALL Qvc.GetFieldValues('vDate', 'SDate', 'SapcrmDump');
// Build a Calendar with default name
CALL Qvc.Calendar(vDate.Min, vDate.Max, 'Survey Calendar', 'SurveyCalendar', 4);
SET vDate.Min=;
SET vDate.Max=;
CALL Qvc.Cleanup;
RENAME Table [Survey Calendar] to STemp;
[Survey Calendar]:
LOAD *,Week(SDate) as [SurveyCalendar Week]
Resident STemp;
DROP Table STemp;
Yes, there the CalendarFromField function that was created for this.
IncidentDetails:
Load * from IncidentDetails;
SapcrmDump:
Load * from SapcrmDump;
call qvc.calendarfromfield('Date', 'FiscalCalendar','','4');
call qvc.calendarfromfield('SDate', 'SurveyCalendar','','4');
Thanks a lot Gysbert!
Same as before:
RENAME Table [Fiscal Calendar] to Temp;
[Fiscal Calendar]:
LOAD *,Week(Date) as [Week]
Resident Temp;
DROP Table Temp;
RENAME Table [Survey Calendar] to STemp;
[Survey Calendar]:
LOAD *,Week(SDate) as [SurveyCalendar Week]
Resident STemp;
DROP Table STemp;
Hi Gysbert,
Could u plz tell me difference btween my calendar script in original post and the one u posted in first reply?
It would be great help to understand the difference in logic.
Thanks in advance!
You replace two calls with only one that's also simpler:
CALL Qvc.GetFieldValues('vDate', 'Date', 'IncidentDetails');
CALL Qvc.Calendar(vDate.Min, vDate.Max, 'Fiscal Calendar', '', 4);
becomes:
call qvc.calendarfromfield('Date', 'FiscalCalendar','','4');
Thanks a lot Gysbert!
Could you plz tell what is the use of the below mentioned script:
CALL Qvc.Cleanup;
From the QVC documentation:
3. At the end of your script, call Cleanup. This will delete Qvc's working variables.