Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Tell us which business and trade publications you read most regularly: RESPOND NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
baarathi
Creator III
Creator III

Variable passing based on successful executoin

I have qlikview file (Transform.qvw), where I extract data from sql tables and transform store it into QVDs and drop the tables in qlikview file.

I have another QlikSense application (Presentation.qvf), where I use QVDs generated from Transform.qvw file.

After my Transform.qvw file reloads successfully , Is it possible to pass a variable (ex : vReload = 1 when reload is successful, vReload = 0 when reload is failed or error occurred) from Transform.qvw to Presentation.qvf

1 Reply
Spivey
Partner - Contributor III
Partner - Contributor III

I don't think you can do exactly what you're thinking of, unfortunately.  It seems like you can just check the QVDCreateTime from your Qlik Sense app to see if those QVDs were created when the QlikView app was expected to be reloaded.

If that won't work for whatever reason, like the QlikView app reloads are irregular times, you can do a (very) rough version of your requirement by using the ErrorMode and ScriptErrorCount system variables.

At the beginning of your QlikView script, set the ErrorMode variable to 0:

set ErrorMode=0;

Then, at the very end of your script, you can just store the value of the ScriptErrorCount variable to a separate QVD that your Qlik Sense app can pick up.

[scriptErrors]:
LOAD
    Now() as [ReloadTimestamp],
    '$(ScriptErrorCount)' as [Script Error Count]
AutoGenerate 1;

Store [scriptErrors] into 'lib://DataFiles/scriptErrors.qvd'(QVD);

Just know that when you set the Error Mode variable to 0, QlikView will not stop the script execution when it encounters errors that would otherwise have stopped it. If that's an issue, then this is not a great solution or you'll just have to add logic throughout the script that will exit the script when the ScriptErrorCount variable is non-zero.