Last active
September 18, 2020 10:46
-
-
Save mindspank/22a9203bcc91483b916eaaff08ff7af8 to your computer and use it in GitHub Desktop.
sessionpage
This file contains 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
define(['qlik', 'qvangular'], function (qlik, qv) { | |
return { | |
initialProperties: { | |
version: 1, | |
qHyperCubeDef: { | |
qSuppressZero: true, | |
qSuppressMissing: true, | |
qInitialDataFetch: [{qTop: 0, qLeft: 0, qWidth: 2, qHeight: 200}] | |
} | |
}, | |
paint: function ($element, layout) { | |
const app = qlik.currApp(); | |
app.model.enigmaModel.createSessionObject({ | |
qInfo: { | |
qId: '', | |
qType: 'myobj' | |
}, | |
qHyperCubeDef: { | |
qDimensions: [{ qDef: { qFieldDefs: ['TransID']}}], | |
qMeasures: [{qDef: {qDef: '=1'}}], | |
qSuppressZero: true, | |
qSuppressMissing: true, | |
qInitialDataFetch: [{qTop: 0, qLeft: 0, qWidth: 2, qHeight: 200}] | |
} | |
}).then(model => { | |
model.getLayout().then(layout => { | |
const columns = layout.qHyperCube.qSize.qcx; | |
const pageheight = Math.floor(10000 / columns); | |
const numberOfPages = Math.ceil(layout.qHyperCube.qSize.qcy / pageheight); | |
let promises = Array.apply(null, Array(numberOfPages)).map(function (data, index) { | |
let page = { | |
qTop: (pageheight * index) + index, | |
qLeft: 0, | |
qWidth: columns, | |
qHeight: pageheight | |
}; | |
return model.getHyperCubeData('/qHyperCubeDef', [page]); | |
}, this) | |
Promise.all(promises).then(function(data) { | |
console.log(data) | |
}); | |
}); | |
}) | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment