Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
devan9876
Creator
Creator

How to fetch hypercube pages for pivot mode?

I have a hypercube in qMode="p" for pivot data and want to use the GetHyperCubePivotData(qPath, qPages) function but I'm lost on what to use for the values in the qPages parameter.

 

Are there any examples of how to fetch additional hypercube pages for pivot data?

Labels (3)
1 Solution

Accepted Solutions
Øystein_Kolsrud
Employee
Employee

The retrieval of data for pivot cubes is pretty much the same as for regular cubes. The difference is that the number of rows and columns depends not only on the selection state, but also on the pivot cube configuration. That's why the method "GetHyperCubePivotData" returns the extra information "qLeft" and "qTop". These properties contains the values of the left column and the top column for the area covered by the page you have retrieved.

But apart from this, there is no real difference from regular hypercubes when it comes to pagination. In fact, you can if you like, use the regular "GetHyperCubeData" also for cubes of pivot type, but then you won't get that "qLeft" and "qTop" information. The total size of the cube can always be found in the property "qSize" of the cube layout. That property contains the two properties "qcx" and "qcy" which states the total number of columns and rows in the table. So if you retrieve a page of say size top=0, left=0, width=qcx and height=y, then there is more data to get if y<=qcy. Then the natural next page to get would be to add "y" to "top" and get the page top=y, left=0, width=qcx, height=y. More data after that? Well, if 2*y >= qcy, then you get the next page. And so on...

View solution in original post

3 Replies
Øystein_Kolsrud
Employee
Employee

Those pivot cubes are certainly somewhat more complicated than regular cubes. But there are actually some examples on how to get data from them in the references documentation:

https://help.qlik.com/en-US/sense-developer/August2023/Subsystems/EngineJSONAPI/Content/service-gene...

In particular this page:

https://help.qlik.com/en-US/sense-developer/August2023/Subsystems/EngineAPI/Content/Sense_EngineAPI/...

Is it something like this you are looking for?

devan9876
Creator
Creator
Author

I was hoping for something in Javascript that shows how to request additional pages until you have the full dataset.

For example,  what should the values of qHeight,qWidth,qTop and qLeft be for subsequent requests to the GetHyperCubePivotData function? and how do I know how many pages I need to request to have everything?

 

The example you posted seems to only show what happens with the first request but not how to get additional pages.

Øystein_Kolsrud
Employee
Employee

The retrieval of data for pivot cubes is pretty much the same as for regular cubes. The difference is that the number of rows and columns depends not only on the selection state, but also on the pivot cube configuration. That's why the method "GetHyperCubePivotData" returns the extra information "qLeft" and "qTop". These properties contains the values of the left column and the top column for the area covered by the page you have retrieved.

But apart from this, there is no real difference from regular hypercubes when it comes to pagination. In fact, you can if you like, use the regular "GetHyperCubeData" also for cubes of pivot type, but then you won't get that "qLeft" and "qTop" information. The total size of the cube can always be found in the property "qSize" of the cube layout. That property contains the two properties "qcx" and "qcy" which states the total number of columns and rows in the table. So if you retrieve a page of say size top=0, left=0, width=qcx and height=y, then there is more data to get if y<=qcy. Then the natural next page to get would be to add "y" to "top" and get the page top=y, left=0, width=qcx, height=y. More data after that? Well, if 2*y >= qcy, then you get the next page. And so on...