Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
again I am struggeling to access qliks' data via js.
I created a cube to fetch data from the qlik app but I need to fetch multiple pages of data and getHyperCubeData() or getData() do not seem to work.
To now my code is the following:
app.createCube({
qDimensions: dimensionDefinition,
qInitialDataFetch: [{
qTop: 0,
qLeft: 0,
qHeight: necessaryHeight,
qWidth: usedFields.length
}]
}, function(reply) {
var allSelections = [];
for(var i = 0; i < usedFields.length; i++){
allSelections.push([]);
}
_.each(reply.qHyperCube.qDataPages[0].qMatrix,function(value){
for(var i = 0; i < usedFields.length; i++){
allSelections.push(value);
}
});
for(var i = 0; i < usedFields.length; i++){
allSelections = _.uniq(_.pluck(allSelections,"qText"));
}
// Somewhere here I would need to conduct additional data requests as necessaryHeight * usedFields.length will exceed 10000 cells
console.log(allSelections);
app.destroySessionObject(reply.qInfo.qId);
});
This gives me an array of arrays with all explicitly applied selections per field.
However, as I learned earlier (props to erik.wetterberg) the qMatrix returns the cartesian product of all values which inflates this data request heavily.
Therefore I either need to request additional data pages in the callback or find a way to avoid this inflated request.
(I tried lists, which are more convenient, but I would have to retrieve a list for every field in which a filter has been set. That gave me a headache in structuring my code as the promises resolve before I could log the lists data.)
Any idea on this is much appreciated, as well as other takes on how to get all selected values for all fields from the qlik engine.
Kind regards,
Marco