Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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;
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
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
Thanks Adam makes sense!