Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
azucna122
Partner - Creator
Partner - Creator

union of two partitioned qvd's

Hi, I am new to qlik,

I would like to make a union of two partitioned qvd's for month. My code is as follows:

SALES:
LOAD
"SALES_ID" as ID,
"NAME_SALES",
"LATEST_DATE_CHARGE" AS LATEST_DATE_CHARGE_SALES,
SALES AS TYPE
FROM
test.xls
(biff, embedded labels, table is SALES$);

LET vcurrentdate= num(YearStart(Today()));

DO WHILE vcurrentdate <= Today()

ExportTable:
NOCONCATENATE
LOAD *
RESIDENT SALES
WHERE InMonth(LATEST_DATE_CHARGE_SALES, $(vcurrentdate), 0) = true();

LET vdatestring = Date($(vcurrentdate), 'YYYYYMM');
STORE ExportTable INTO [QVDS\SALES_$(vdatestring).QVD] (qvd);
DROP Table ExportTable;


join (SALES)

PRODUCTS:
LOAD
"ID_PRODUCTS" as ID,
"NAME_PRODUCTS" AS NAME,
"LAST_MODIFIED" AS LAST_MODIFIED_PRODUCTS,
PRODUCTS AS TYPE
FROM
test.xls
(biff, embedded labels, table is PRODUCTS$);

LET vcurrentdate= num(YearStart(Today()));

DO WHILE vcurrentdate <= Today()

ExportTable:
NOCONCATENATE
LOAD *
RESIDENT SALES
WHERE InMonth(LATEST_DATE_CHARGE_SALES, $(vcurrentdate), 0) = true();

LET vdatestring = Date($(vcurrentdate), 'YYYYYMM');
STORE ExportTable INTO [QVDS\SALES_$(vdatestring).QVD] (qvd);
DROP Table ExportTable;

I'm getting an error in the NOCONCATENATE loop, do you know why?

2 Replies
panosalexand
Creator
Creator

Hi,

Usually when you set, let variables is better to set them at the beginning of the script.

I would move the variable in first line. Check the question mark where it close. Maybe after today(). 

If that isn't working try to load with the  debug method just to see where is the real issue. 

Gabbar
Specialist
Specialist

I think you are not changing value of this variable anywhere, also It seems you have copy pasted script twice, and could you paste it again.
 LET vcurrentdate= num(YearStart(Today()));