Skip to main content

Qlik Sense Documents

Qlik Sense documentation and resources.

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE

Qlik Tips: Avoiding STORE problems (and try again)

cancel
Showing results for 
Search instead for 
Did you mean: 
lfetensini
Partner - Creator II
Partner - Creator II

Qlik Tips: Avoiding STORE problems (and try again)

Attachments

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

Else

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
Last update:
‎2021-02-01 02:02 PM
Updated by:
Contributors