Hi,
I have a variable that represents a connection to another reporting system. how can I ensure that this var is visible in my helpers and events. I now create this var inside my onrendered function. But if I want to use it in my helper it says undefined. I tried to create a var on file level but this does not work: > Exception in template helper: ReferenceError: qlik is not defined
`var config = {
host: window.location.hostname,
prefix: “/”,
port: 80,
isSecure: window.location.protocol === “https:”
};
Template.multipleDivs.helpers({
appList: function () {
// …
var list = qlik.getAppList(function(list){}, config);
console.log(list)
return list;
}
});
Template.multipleDivs.onRendered(function() {
require.config( {
baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port: "") + config.prefix + "resources"
} );
require( ["js/qlik"], function ( q ) {
qlik = q;
qlik.setOnError( function ( error ) {
alert( error.message );
} );
//open apps -- inserted here --
var app = qlik.openApp('debd03a3-a2a9-41cc-901c-d21b44279783', config);
//get objects -- inserted here --
app.getObject('QV04','grmSd');
app.getObject('QV02','GdjmWq');
app.getObject('CurrentSelections','CurrentSelections');
app.getObject('QV01','JfpX');
app.getObject('QV03','Qjndk');
} );
});`