Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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;

Tags (1)
7 Replies

Re: Calendar using .qvc file

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

Re: Calendar using .qvc file

Thanks a lot Gysbert!

Re: Calendar using .qvc file

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

Re: Calendar using .qvc file

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!

Re: Calendar using .qvc file

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

Re: Calendar using .qvc file

Thanks a lot Gysbert!

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

CALL Qvc.Cleanup;

Not applicable

Re: Calendar using .qvc file

From the QVC documentation:

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

Community Browser