Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
JShum
Contributor II
Contributor II

sending the qlik object to a function inside the extension

I am trying to write a simple extension in the paint section of my extension.  

I am creating an input box and in the onchange event I want to call a function and send the qlik object I guess so I can get the current app inside the function, or send the reference to the current app.  Is there a way to do that.  Here is what I got
I tried sending the variable a and it doesn't work.

paint: function ($element) {
//add your rendering code here

//var app = qlik.openApp('5b984685-4ba7-4e0a-8552-e36f02626a62', config);
//GenericVariable GetVariableByName([QixName("qName")] vtest)

var qApp = qlik.currApp(this);

qApp.variable.getContent('jtest').then(function(reply){
console.log(JSON.stringify( reply ) )
});

qApp.variable.setStringValue('jtest','changed').then(
console.log("setvalue"));

qApp.variable.getContent('jtest').then(function(reply){
console.log(JSON.stringify( reply ) )
});
var a = 1;


var test = '<label class="lui-label">Janet Test</label><input type="date" id="DateInput" style="width:140px;" onchange="myFunction(a)">'

$element.empty();
$element.append(test);
//needed for export
return qlik.Promise.resolve();
}
};

Labels (2)
1 Reply
alex_colombo
Employee
Employee

Hi @JShum , are you trying to read input box value when onchange event is triggered and then use it for setting Qlik Sense variable value?