Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Talk to Experts Tuesday, Live Q&A, September 22: Moving from QlikView to Qlik Sense. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

Not sure whats going on here!

Hi, quite new to QV and trying to learn as much possible as quickly as I can. I seem to get very confused within the script as it is a strange language for me having never done this type of thing before. Could someone please help me understand whats going on here:

tmpCurrentMonth:

NoConcatenate

LOAD 

     [Year-Month]

FROM

[$(vTransformedQVDPath)\Master Calendar.qvd]

(qvd)

Where MonthDiff = 0;

LET vCurrentYearMonth = Peek('Year-Month',0,'tmpCurrentMonth');

DROP Table tmpCurrentMonth;

tmpPreviousMonth:

NoConcatenate

LOAD 

     [Year-Month]

FROM

[$(vTransformedQVDPath)\Master Calendar.qvd]

(qvd)

Where MonthDiff = 1;

LET vPreviousYearMonth = Peek('Year-Month',0,'tmpPreviousMonth');

DROP Table tmpPreviousMonth;

1 Solution

Accepted Solutions
Highlighted
Creator III
Creator III

tmpCurrentMonth:

NoConcatenate

LOAD

     [Year-Month]

FROM

[$(vTransformedQVDPath)\Master Calendar.qvd]

(qvd)

Where MonthDiff = 0;

LET vCurrentYearMonth = Peek('Year-Month',0,'tmpCurrentMonth');

DROP Table tmpCurrentMonth;

The above is loading from a Master Calendar qvd (QlikView Data File) where a field in that file (MonthDiff) equals 0. Peek is a function to look inside a table based on a row number, so this is looking in the tmpCurrentMonth table, at the 0 (i.e. first) row and getting the value for Year-Month. That's being stored in a variable called vCurrentYearMonth. The table then gets dropped (i.e. deleted) at the end.

tmpPreviousMonth:

NoConcatenate

LOAD

     [Year-Month]

FROM

[$(vTransformedQVDPath)\Master Calendar.qvd]

(qvd)

Where MonthDiff = 1;

LET vPreviousYearMonth = Peek('Year-Month',0,'tmpPreviousMonth');

DROP Table tmpPreviousMonth;

The second half of the script is doing the same thing. It's loading from a QVD file into a table called tmpPreviousMonth where the MonthDiff field equals 1. It is then putting the value of the Year-Month field in the first row into a variable called vPreviousYearMonth. It then drops this table too.

At the end you are left with two variables containing the Year-Month for the current month and previous month

View solution in original post

2 Replies
Highlighted
Creator III
Creator III

tmpCurrentMonth:

NoConcatenate

LOAD

     [Year-Month]

FROM

[$(vTransformedQVDPath)\Master Calendar.qvd]

(qvd)

Where MonthDiff = 0;

LET vCurrentYearMonth = Peek('Year-Month',0,'tmpCurrentMonth');

DROP Table tmpCurrentMonth;

The above is loading from a Master Calendar qvd (QlikView Data File) where a field in that file (MonthDiff) equals 0. Peek is a function to look inside a table based on a row number, so this is looking in the tmpCurrentMonth table, at the 0 (i.e. first) row and getting the value for Year-Month. That's being stored in a variable called vCurrentYearMonth. The table then gets dropped (i.e. deleted) at the end.

tmpPreviousMonth:

NoConcatenate

LOAD

     [Year-Month]

FROM

[$(vTransformedQVDPath)\Master Calendar.qvd]

(qvd)

Where MonthDiff = 1;

LET vPreviousYearMonth = Peek('Year-Month',0,'tmpPreviousMonth');

DROP Table tmpPreviousMonth;

The second half of the script is doing the same thing. It's loading from a QVD file into a table called tmpPreviousMonth where the MonthDiff field equals 1. It is then putting the value of the Year-Month field in the first row into a variable called vPreviousYearMonth. It then drops this table too.

At the end you are left with two variables containing the Year-Month for the current month and previous month

View solution in original post

Highlighted
Contributor II
Contributor II

Thanks Adam makes sense!