Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
markella92
New Contributor

how load QVD file only if it has records otherwise not

Hi guys, how can i load QVD file only if QVD has records?

THANKS

Labels (2)
5 Replies
mrybalko
Contributor II

Re: how load QVD file only if it has records otherwise not

ignacio_pena
New Contributor III

Re: how load QVD file only if it has records otherwise not

Hi Markella92,

You Could try the next option:

if filesize('NAME_QVD.qvd') > 0 then

TABLE1:
LOAD
A,
B,
C
FROM
NAME_QVD.qvd
(qvd);

else

/*In this part you should put what happens if you do not load the qvd. For example load table from database */

TABLE1:
LOAD
A,
B,
C
;
SQL SELECT A, B, C
FROM TABLE_BBDD;

end if

A greeting,

 

"

markella92
New Contributor

Re: how load QVD file only if it has records otherwise not

i use QvdNoOfRecords() with IF-ELSE statement?
markella92
New Contributor

Re: how load QVD file only if it has records otherwise not

how can i stop execution in ELSE statement? with exit script? and can i show a pop up with a message?
ignacio_pena
New Contributor III

Re: how load QVD file only if it has records otherwise not

Hi,

If you put "exit script" the script it will end. You can put:

Else 

exit script

end if

....and continue with the rest of the script or finish the reload with other exit script.

If  what you need is to trace the code it is best to put in debug mode:

https://help.qlik.com/en-US/sense/November2018/Subsystems/Hub/Content/Sense_Hub/LoadData/debug-data-...