Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
chris_johnson
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
chris_johnson
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

Anonymous
Not applicable
Author

Thanks Adam makes sense!