Skip to content

Instantly share code, notes, and snippets.

@mindspank
Last active September 8, 2015 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mindspank/474fee90c19ca9bff37e to your computer and use it in GitHub Desktop.
Save mindspank/474fee90c19ca9bff37e to your computer and use it in GitHub Desktop.
var qsocks = require('qsocks')
// Connecting to Qlik Sense Desktop
var connect = qsocks.Connect()
connect
.then(function(global) {
// from the global handle we can invoke methods from the global class
return global.openDoc('Executive Dashboard.qvf')
})
.then(function(app) {
// returns a app handle which we can invoke app methods on
// Create a dimension
return app.createDimension({
qInfo: {
qId: '', // This can be left blank if you want the engine to assign a ID for you.
qType: 'dimension'
},
qDim: {
qGrouping: 'N', // N = no grouping, H = drill-group, C = cyclic grouping
qFieldDefs: ['ARCredit'],
qFieldLabels: ['AR Credit Rating'],
title: 'This is my Client title' //This is a dynamic property, engine does not care about it. Only used for the client.
},
qMetaDef: {
title: 'This is my Client title',
tags: ['TaggieTag'],
description: 'This is a description that is used in the client.'
}
}).then(function(dimension) {
// we now have access to the dimension. No going to use it here, instead
// I'll persist the changes by calling doSave on the app handle.
return app.doSave()
})
})
.then(function() {
console.log('All Done')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment