Qlik Community

Ask a Question


Qlik Sense documentation and resources.

QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY

Qlik Tips: Avoiding STORE problems (and try again)


Qlik Tips: Avoiding STORE problems (and try again)

This sounds absurd, but how many times do we experience problems when recording QVD, whether due to the action of antivirus, an application sharing the given moment among the most diverse generic errors of storage systems?

Here is a nice solution for you to make this attempt X number of times waiting for a Y interval of time.

And of course, so that you can reuse the code in your application.


Well, let's Qlik:


Sub Store_QVD(TableName, Path)

// Example: Call Store_QVD('Dim_Mytable', 'lib://Files/QVD/');

// Initials parameters:de
Set ErrorMode = 0; // Force to 0. Qlik will simply ignore the failure and continue script execution at the next script statement.
Set Store_QVD_Attempt = 0; // Force to initial 0.
Set Store_QVD_Attempt_Nr = 10; // How many times do you wanna try again the STORE command...
Set Store_QVD_Attempt_Sleep = 20000; // How many miliseconds to wait before a new attemp.

Do while True()

// Main command to store:
Store [$(TableName)] into [$(Path)/$(TableName).qvd] (qvd);

// Now let's check if everything worked out
If $(ScriptErrorCount) = 0 then

// If everything is OK and QVD was stored, continue the load script...
Exit Do


Let Store_QVD_Attempt = Store_QVD_Attempt + 1;
Trace '## ERRORS until now: $(Store_QVD_Attempt).';

End If // Start at: If $(ScriptErrorCount) = 0 then

// If we already get all the attempts:
If ($(Store_QVD_Attempt) = $(Store_QVD_Attempt_Nr)) then

// Show the final error:
Trace '## ERROR to save [$(TableName)] into [$(Path)/$(TableName).qvd] after $(Store_QVD_Attempt_Nr) attempts.';

// Qlik Sense will trigger an "Execution of script failed..." error message immediately on failure, without prompting the user for action beforehand.
Set ErrorMode = 2;

End If

// If we get an error, inform:
Trace '## ERROR to save [$(TableName)] into [$(Path)/$(TableName).qvd]. Attempt $(Store_QVD_Attempt) of $(Store_QVD_Attempt_Nr).';

Sleep $(Store_QVD_Attempt_Sleep); // Wait for X milisecondss befor try again.

Loop // Start at: Do while True()

// Houston, we have a problem...
Set ErrorMode = 2;

End Sub // Start at: Sub Store_QVD(TableName, Path)

Labels (4)
Version history
Revision #:
1 of 1
Last update:
‎2021-02-01 02:02 PM
Updated by: