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
I'm building a customized search box and I'm trying to use your function. My problem is that I need to quickly provide a search facility to over 20,000 items. I tried using getData but it's very slow and unacceptable for what I need to do.
When I use your function, all is fine until the Promise.all(). It returns zero items in the data array. I tried using $q from an injector and also using: var Promise = qv.getService('$q').
With the help of this post, we are trying to use Jquery Promise and not angular, we do get the number of pages and total columns, but we are facing error on Promise.all.
I have got stuck on this part though deferred.resolve(data.qDataPages[0].qMatrix);
The error message states Cannot read property '0' of undefined
The other weird thing is that the value of data.qHyperCube is undefined. The total height is returned by model.layout.qHyperCube.qSize.qcy so it's like the hypercube is only holding the meta data but no actual data