Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Hoping for some help with building a big JavaScript object from a HyperCube that goes to more than 10000 cells.
It's a straightforward AngularJS extension, and I've found the article for retrieving extra data here: https://help.qlik.com/en-US/sense-developer/May2021/Subsystems/Extensions/Content/Sense_Extensions/H...
The issue I have is that I don't really want to call my paint function for every page of the HyperCube. What I actually want to do is build a chunky JavaScript array of all the data that I can then operate on to use in my template.
Basically, at the end of the day, I'm trying to work out the best method to loop through all pages of the huge HyperCube in a single execution of paint so that I can modify the structure of the data to suit the needs of the extension.
I've added comments to the code here to better explain what I'm trying to achieve.
Ok, solved it.
I've made some progress on this, and think I'm nearly where I need to be with it, but there's still a small problem I hope someone can help me with, or tell me where I'm off track.
This is my paint function, now:
I'm running a loop to build the page requests for each execution of backendApi.getData, pushing the promises into an array then executing them with Promise.all
Logging the array thePromises to the console produces the below, which superficially looks fine:
but the following error is thrown from the Promise.all function call:
Further examination of the promises in the array reveals the cause:
I can confirm that executing just the first promise from the array works ok, like this:
So does executing it twice in an array:
So, something's not working properly in the loop that builds the array, and the second iteration is not receiving the backendApi.getData promise correctly.
Is this an issue with reference typing, or something else to do with my understanding of this particular promis object?
Can anyone help with how to get this last part over the line?
Ok, solved it.