Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Incremental Load without primary key and modification_date column

Hi

I am facing an issue with performing concatenation in the end of the qvd refresh with a combination of columns. with primary key (with another table) it's working fine, but with combination keys it 's giving error.

Any comments

Thanks

Preena

Following is the script:

SET QVDFILE =qvdfile.qvd;
LET datatable='myDataTable';

IF FileSize('$(QVDFILE)') > 0 THEN
SET QVD_EXISTS=1;
ELSE
SET QVD_EXISTS=0;
END IF

IF $(QVD_EXISTS) THEN

LOAD max(date(process_time)) as maxdate from $(QVDFILE)(qvd);
Let testdate = chr(39) & fieldValue('maxdate', 1) & chr(39);

$(datatable):
Directory;
Select a.*,month(Baldt) MonthNum from view a(nolock)
where process_time >= $(testdate) order by Year,Quarter,MonthNum,BalDt;
ELSE // If Qvd does not exists or deleted, it will do full reload
$(datatable):
Directory;
Select a.*,datepart(dw,BalDt) as wkday from view a(nolock) order by Year,Quarter,MonthNum,BalDt;
END IF


IF $(QVD_EXISTS) THEN
Concatenate Load * from $(QVDFILE)(qvd) where not exists(Inventory_id);
Inner Join Select Inventory_id from view(nolock);
END IF


STORE $(datatable) INTO $(QVDFILE);
Drop table $(datatable);

TestTable:
Load * from $(QVDFILE)(qvd);

10 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The $(PKexp) variable was created earlier in the thread with a SET statement.

You can use the Date field as your key, but in this case it will be a group key, not a primary key. So as long as you are ok with always replacing the entire set for a Date try this:

MyData:

LOAD

     foo,

     Date,

     Date as Date2,

     ... FROM xyz.xls;

Concatenate (MyData)

LOAD * FROM MyData.qvd (qvd)

WHERE NOT EXISTS (Date, Date2);

-Rob