As I was working on one of my latest mashups, I had a task, to get all cells with numerous sets of dimensions and measures, with a HyperCube out of Qlik Sense. The worst part is that one of my sets, had a total of 3+ million cells!
We know that the initial HyperCube returns only up to ~10k cells, So the question is how do we paginate to get the rest or even get them all in one call!
We also know that, most of the Capability API methods are using promises, something very helpful, especially if we make a lot of calls to Qlik Sense and expect to return the results only when all of the promises have been resolved. This is where promises “.all()” come into play.
Even though ES6 has promises build in, not all browsers support it yet, so I will use Angular's $q to handle those promises.
First we have to make the initial call and get the maximum rows and columns. We start by creating the cube with the dimensions
app.createCube({
qDimensions : qDimensions,
qMeasures : qMeasures
}).then(function(model) {
Once we have the model ready, we make the initial call to get the first set of results and get the HyperCube info like total columns and total rows