Last active
January 18, 2022 04:13
-
-
Save mindspank/58b3080a342b1cd937e6 to your computer and use it in GitHub Desktop.
HyperCube Sample #engineapi #qsocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) }) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great Example! maybe you can add this one too, next to your qsocks examples? (and maybe also to enigma.js)