Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I've been trying to work out why calls to qlik.app.doReload() this code works and calls to qlik.app.variable.setStringValue() also work but if the doReload is called after the setStringValue then an error is generated by the doReload
qlik.currApp(this).variable.setStringValue("LoadType","Catalogue").then
{
alert("ReLoad");
qlik.currApp(this).doReload();
}
This generates an error from an uncaught promise
Ue | @ | enigma.6097683….js:9 | |
c | @ | angular.f3474da….js:9 | |
(anonymous) | @ | angular.f3474da….js:9 | |
$digest | @ | angular.f3474da….js:9 | |
$apply | @ | angular.f3474da….js:9 | |
f | @ | qvangular.38ae0bf….js:9 | |
(anonymous) | @ | setup-view.800e26a….js:9 | |
Promise.then (async) | |||
pp | @ | setup-view.800e26a….js:9 | |
o | @ | setup-view.800e26a….js:9 | |
(anonymous) | @ | setup-view.800e26a….js:9 | |
(anonymous) | @ | setup-view.800e26a….js:9 | |
t | @ | setup-view.800e26a….js:9 | |
(anonymous) | @ | responsive-state.38d…08ccf2bc5ad9f9.js:9 | |
e | @ | responsive-state.38d…08ccf2bc5ad9f9.js:9 | |
e | @ | setup-view.800e26a….js:9 | |
(anonymous) | @ | setup-view.800e26a….js:9 | |
t.emit | @ | enigma.6097683….js:9 | |
e | @ | enigma.6097683….js:9 | |
(anonymous) | @ | enigma.6097683….js:9 | |
e | @ | enigma.6097683….js:9 | |
t.emit | @ | enigma.6097683….js:9 | |
e | @ | enigma.6097683….js:9 |
The desired behavior is to set a variable and then trigger a reload
Hi,
There is actually an error message in there:
Error: Reload in progress
Try catching errors from doReload() and handle them.
There are also other ways to run a reload, I have written on those in a couple of posts:
https://extendingqlik.upper88.com/run-a-reload-from-a-qlik-sense-mashup/
https://extendingqlik.upper88.com/a-third-way-to-run-a-reload-from-a-qlik-sense-mashup/
Though I don't know if any of these would work in your scenario.
Hi,
Thanks, I cannot figure out how to apply the 2 mashup methods in my scenario.
What I'm trying to achieve is to load a data catalogue, allow the user to select certain items and then click a button to load the files in the selected catalogue items. I'm able to pass the selected items to the load script via variables. This works but I have to have 2 separate buttons at the moment one to set the variables and a separate one to trigger the reload.
When I put code in to catch the errors it is interesting that the error occurs after successful execution of the reload. ie in the code below the alert "Finished" is seen before the error occurs triggering an automatic reload.
app.variable.setStringValue("LoadType","Catalogue").then(function success(b) {
app.doReload().then(function success(a) {
app.doSave();
alert("Finsihed");
}, function reject(a) {
alert("Re-Load Failed");
});
}, function fail(b) {
alert("Set Variable Failed");
});
by accident I found that clicking the button when the sheet is in edit mode the code is successfully executed and no error is generated with all subsequent executions when the sheet is not in edit mode also being successful.
Reload the app and the error returns