Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

hlines_usacs
Contributor II

Delete or Empty QVD in Load Script

Hello,

I need to either delete a qvd file or empty it using the load script. I have tried both and have not been successfully.

I have tried using the EXECUTE command and the script failed. I have tried using this to empty the files, but I get an message saying they do not exist, when they actually do exist.

Sub EmptyQvd(qvdFilePath)

TRACE --;

TRACE Start EmptyQvd for file $(qvdFilePath);

// First check if the qvd-file exists

if (not IsNull(QvdCreateTime(qvdFilePath))) then

TRACE ... file exists ...;

// Check if the Qvd-file contains more than 0 records

if(QvdNoOfRecords(qvdFilePath) > 0) then

tmp_qvd_table:

NoConcatenate

load *

where 1=2;

first 1

load *

from [$(qvdFilePath)](qvd);

store tmp_qvd_table into [$(qvdFilePath)](qvd);

Drop table tmp_qvd_table;

end if ;

else

TRACE ... file '$(qvdFilePath)' does not exist;

end if;

TRACE finished EmptyQvd;

TRACE --;

End Sub

;

Call EmptyQvd('\\server\ProgramData\Qlik\Sense\Log\governanceLogContent_7.8.0-usage_file.qvd');

Call EmptyQvd('\\server\ProgramData\Qlik\Sense\Log\governance_time_range_ops_7.8.0-usage.qvd');

Call EmptyQvd('\\server\ProgramData\Qlik\Sense\Log\governance_date_time_ops_7.8.0-usage.qvd');

1 Solution

Accepted Solutions
mikaelsc
Contributor III

Re: Delete or Empty QVD in Load Script

but you don't seem to be using it when calling your EmptyQVD sub...

'\\server\ProgramData\Qlik\Sense\Log\governanceLogContent_7.8.0-usage_file.qvd'


i'd expect something like

Call EmptyQvd('lib://LOGS\Log\governanceLogContent_7.8.0-usage_file.qvd');


with LOGS defined as connection : \\server\ProgramData\Qlik\Sense



7 Replies
martinpohl
Valued Contributor II

Re: Delete or Empty QVD in Load Script

can you share the document log please?

Regards

hlines_usacs
Contributor II

Re: Delete or Empty QVD in Load Script

I am sorry, but I cannot. It has some confidential data that I cannot share. Is there a specific piece of information in the log I can summarize for you instead?

martinpohl
Valued Contributor II

Re: Delete or Empty QVD in Load Script

I want to see what happens if the error occurs

(How many datas are loaded, what state has your if-clause and so on)

Maybe you can reload with one file where the error occurs and delete details you don't want to share.

mikaelsc
Contributor III

Re: Delete or Empty QVD in Load Script

does your connection exist?

(don't see a lib:// ... )

hlines_usacs
Contributor II

Re: Delete or Empty QVD in Load Script

I do have a connection. This was just a subset of the script.

mikaelsc
Contributor III

Re: Delete or Empty QVD in Load Script

but you don't seem to be using it when calling your EmptyQVD sub...

'\\server\ProgramData\Qlik\Sense\Log\governanceLogContent_7.8.0-usage_file.qvd'


i'd expect something like

Call EmptyQvd('lib://LOGS\Log\governanceLogContent_7.8.0-usage_file.qvd');


with LOGS defined as connection : \\server\ProgramData\Qlik\Sense



hlines_usacs
Contributor II

Re: Delete or Empty QVD in Load Script

The example I was using as a reference didn't have any connections. After adding this, I was successful. Thanks!