Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calendar using .qvc file

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;

7 Replies
Gysbert_Wassenaar

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');


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks a lot Gysbert!

Gysbert_Wassenaar

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;


talk is cheap, supply exceeds demand
Not applicable
Author

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!

Gysbert_Wassenaar

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');


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks a lot Gysbert!

Could you plz tell what is the use of the below mentioned script:

CALL Qvc.Cleanup;

Not applicable
Author

From the QVC documentation:

3. At the end of your script, call Cleanup. This will delete Qvc's working variables.