Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello people,
How can I get the variable value after setting it using app.variable.setStringValue?
It doesn't seem to change using app.variable.getByName or app.variable.getContent (Maybe I'm using them wrong)
I'm making a button that can set and unset a variable or filter in a field, but I cant seem to retrieve the variable to carry the pressed style over the next page
Thank you
Any hints as to what is the solution?
I am facing the same issue.
Hi,
Is this maybe something that you are after?
qix.app.getVariableByName("variableName").then(function(variable){
variable.getLayout().then(function(variableLayout) {
console.log("variableLayout", variableLayout);
});
});
I use this code to get the variable val
var app = qlik.currApp(this);
var qix = this.backendApi.model.enigmaModel.session;
var numericValue;
qix.app.getVariableByName('vTestMode').then(function (variable) {
variable.getLayout().then(function (variableLayout) {
numericValue = variableLayout.qNum;
});
});
but i seem to get Cannot read property 'model' of undefined error?
Hi nikoskavroulakis,
You shouldn't use unsupported method - those may/will change over time, instead use the Variable API ‒ Qlik Sense Developers
let app = qlik.currApp(this);
let numericValue;
app.variable.getByName('vTestMode').then(variableModel => {
variableModel.getLayout().then(variable => {
numericValue = variableLayout.qNum;
});
});
I hope this helps
Hi Aiham,
Isn't the Qlik Engine API supported, or why isn't my suggestion a way to go?
The enigmaModel is not documented/supported and may change, the engine API is supported, but they are not the same, some enigma methods are mixins that make data transformation.
so for example (not likely to change but anyway as an example), getVariableName may change from returning a model to actually return the variable result, which can break your extensions.
Ok, thank you for the explanation