Skip to content

Instantly share code, notes, and snippets.

@mindspank
Last active January 18, 2022 04:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mindspank/58b3080a342b1cd937e6 to your computer and use it in GitHub Desktop.
Save mindspank/58b3080a342b1cd937e6 to your computer and use it in GitHub Desktop.
HyperCube Sample #engineapi #qsocks
const qsocks = require('qsocks');
qsocks.Connect({
host: 'branch.qlik.com',
prefix: 'anon',
isSecure: true
})
.then(function(global) {
return global.openDoc('3f3a866b-238f-4d1a-8aeb-81e97756af7a')
})
.then(function(app) {
// Create a Generic Session Object
app.createSessionObject({
qInfo: {
qType: 'mycubiecube'
},
// A HyperCube Structure
qHyperCubeDef: {
qDimensions: [{
qDef: {
qFieldDefs: ['Brewery']
}
}],
qMeasures: [{
qDef: {
qLabel: 'Number of Beers',
qDef: '=Count(Beer)'
}
}],
qInitialDataFetch: [{
qWidth: 2,
qHeight: 4000,
qTop: 0,
qLeft: 0
}]
},
// Independent calculation using a ValueExpression
total: {
qValueExpression: { qExpr: "=Count(DISTINCT Brewery)" }
}
}).then(function(cube) {
return cube.getLayout().then(function(layout) {
return console.log(layout)
})
})
.catch(function(err) { console.log(err) })
});
@QHose
Copy link

QHose commented Dec 24, 2016

Great Example! maybe you can add this one too, next to your qsocks examples? (and maybe also to enigma.js)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment