Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Help with Master calendar script error in the Qlik Tutorial

I just tried the Qlik "Building an App" tutorial and found myself with a script error while creating the master calendar. Is it user error on my part, or is there indeed a typo in the tutorial. Any help in getting past this would be greatly appreciated. Here's the error message:


Script line error: : TempCalendar: LOAD DATE( + ROWNO() -1) AS TempDate AUTOGENERATE - +1

And here's my script code that I copy/pasted from page 33 of "Qlik Sense Tutorial - Building an App.pdf"

LET varMinDate = NUM(PEEK('Date',0,'Sales data'));

LET varMaxDate = NUM(PEEK('Date',-1,'Sales data'));

TempCalendar:

LOAD

DATE($(varMinDate) + ROWNO() -1) AS TempDate

AUTOGENERATE $(varMaxDate) - $(varMinDate) +1;

// Create the Master Calendar

MasterCalendar:

LOAD

DATE(TempDate) AS Date,

WEEK(TempDate) AS Week,

YEAR(TempDate) AS Year,

MONTH(TempDate) AS Month,

DAY(TempDate) AS Day,

INYEARTODATE(TempDate,'2014-03-31', 0) *-1 AS CYTDFlag,

INYEARTODATE(TempDate,'2013-03-31',0) *-1 AS LYTDFlag,

DATE(MONTHSTART(TempDate), 'MMM-YYYY') AS MonthYear,

'Q' & CEIL(MONTH(TempDate)/3) AS Quarter,

WEEK(TempDate)&'-'&YEAR(TempDate) AS WeekYear,

WEEKDAY(TempDate) AS WeekDay

RESIDENT

TempCalendar

Order BY

TempDate ASC;

DROP FIELD TempDate;

1 Solution

Accepted Solutions

Re: Help with Master calendar script error in the Qlik Tutorial

"...which had me add Sales as the first step (actually instruction 3 says to add "Sales data" but I figured that was leftover from an old name)..."

That's the issue. The Peek() functions

LET varMinDate = NUM(PEEK('Date',0,'Sales data'));


are looking for a table named 'Sales data'. Your table is named "Sales" (I agree the instructions are ambiguous). Make things match up in one of two ways.


1. Change both peek functions to reference your "Sales" table.

LET varMinDate = NUM(PEEK('Date',0,'Sales'));

LET varMaxDate = NUM(PEEK('Date',-1,'Sales'));

or

2. Change the name of table "Sales" to "Sales data". Add a table label before the Sales load.

[Sales data]:

-Rob

http://masterssummit.com

http://robwunderlich.com

12 Replies

Re: Help with Master calendar script error in the Qlik Tutorial

I can't find the pdf doc you are referring to. But the script problem is that both varMinDate and varMaxDate are null. These statements are not returning a result date.

LET varMinDate = NUM(PEEK('Date',0,'Sales data'));

LET varMaxDate = NUM(PEEK('Date',-1,'Sales data'));

Is there previous script that loads the "Sales data" table with field "Date"? Note that the case and spelling of both those must match exactly the way the table was created.

-Rob

Employee
Employee

Re: Help with Master calendar script error in the Qlik Tutorial

Ed - can you tell us where you found this tutorial? I believe you may be referring to the one on the help site located here correct: https://help.qlik.com/sense/en-US/online/index.html#TutorialsExamples.htm%3FTocPath%3D_____5

I have not personally gone through that tutorial, but can have a Qlik Team member verify it for you.

Did you drag this Syntax block - down to the bottom, so that any previous code that has been entered is on top.

There is a step located here: #6 "Use the = handle (o) to drag the section Master calendar to the bottom of the list" below the SET statements

I believe that may be the problem, please let us know.

Also in case you are interested:

Other shorter and simpler tutorials and videos can be found here:

Qlik Sense Resources

A simple one here: Qlik Sense Desktop - Create your first App (video)

And a more advanced one here: Qlik Sense Desktop - 30 Minute Quick Start Tutorial

Please verify and let us know.

Regards,

Mike

Qlik

Regards,
Mike Tarallo
Qlik
Not applicable

Re: Help with Master calendar script error in the Qlik Tutorial

I would say you missed to move the Section to the bottom as mentioned on point 6 after the Script copy

6. Use the handle (o) to drag the section Master calendar to the bottom of the list.

When I move the section to the top I get the same error.

Not applicable

Re: Help with Master calendar script error in the Qlik Tutorial

Yes, Michael, that's the .pdf. I did indeed drag the Master calendar section as instructed. I've attached a screenshot if that'll help.Qlik Problem.png

Employee
Employee

Re: Help with Master calendar script error in the Qlik Tutorial

OK thanks Ed looking into this for you.

Mike

Regards,
Mike Tarallo
Qlik

Re: Help with Master calendar script error in the Qlik Tutorial

I don't see the "Sales.xlsx" in the Section pane. That should have been loaded on page 21 of the tutorial.

-Rob

Employee
Employee

Re: Help with Master calendar script error in the Qlik Tutorial

Yep that has to be it - he is a screenshot from the PDF on page 7 - good catch Rob!

Regards,
Mike Tarallo
Qlik
Not applicable

Re: Help with Master calendar script error in the Qlik Tutorial

Maybe, but I did include it. I followed the ODBC connection path (sec 4.5), which had me add Sales as the first step (actually instruction 3 says to add "Sales data" but I figured that was leftover from an old name). Just to verify, I started it again. Here are 2 screenshots. It appears that Sales doesn't show on the script list, but it does in the Data Model Viewer.

Qlik1.png

Qlik2.png

Re: Help with Master calendar script error in the Qlik Tutorial

"...which had me add Sales as the first step (actually instruction 3 says to add "Sales data" but I figured that was leftover from an old name)..."

That's the issue. The Peek() functions

LET varMinDate = NUM(PEEK('Date',0,'Sales data'));


are looking for a table named 'Sales data'. Your table is named "Sales" (I agree the instructions are ambiguous). Make things match up in one of two ways.


1. Change both peek functions to reference your "Sales" table.

LET varMinDate = NUM(PEEK('Date',0,'Sales'));

LET varMaxDate = NUM(PEEK('Date',-1,'Sales'));

or

2. Change the name of table "Sales" to "Sales data". Add a table label before the Sales load.

[Sales data]:

-Rob

http://masterssummit.com

http://robwunderlich.com

Community Browser