Skip to content

Instantly share code, notes, and snippets.

@mindspank
Last active September 20, 2015 17:01
Show Gist options
  • Save mindspank/6b18348dc8535029ab52 to your computer and use it in GitHub Desktop.
Save mindspank/6b18348dc8535029ab52 to your computer and use it in GitHub Desktop.
qsocks - sample
//Require the module
var qsocks = require('qsocks');
//For Qlik Sense Desktop
//You have two different entry points, the global handle or connect directly to an app.
//The entire Engine API is async and managed through promises in this module.
//Global
//Connecting to the Engine, once connected returns the handle for global.
qsocks.Connect().then(function(global) {
//We now have a global handle and can execute functions using it.
global.getDocList().then(function(list) {
console.dir(list)
});
global.oSVersion().then(function(version) {
console.log(version);
})
//We can also open a app, this returns a new handle.
//With that handle we can interact with the app.
global.openDoc('Helpdesk Management').then(function(app) {
//Create a variable
app.createVariable('MyNewVariable').then(function(reply) {
console.log(reply) //true or false
});
})
});
//If you know which app you want to connect to you can connect to it directly instead of going through the global handle.
qsocks.Connect({appname: 'Helpdesk Management'}).then(function(app) {
//do stuff with app.
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment