Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Api to retrieve data(All rows) based on field/Dimension given

Hi,

I have a set of fields/dimensions(my case) for which I need to retrieve the data(all Values/rows) .

I strongly believe there can be a possibility as qliksense can be used as a data warehouse.

Please help me with the APIs that needs to be used to achieve my requirement.

Thanks in advance!!

Regards,

Kiriti

5 Replies
Øystein_Kolsrud
Employee
Employee

I guess the exact approach will depend on the technology you use, but you might want do look at this site which describes how to get data in C#:

Retrieving data ‒ Qlik Sense

In particular, you can use these two methods together:

AppExtensions.GetAppField Method

DataPager.IteratePages Method

The code would look something like this (for a field named "Country"):

var appField = app.GetAppField("Country");

var initalPage = new NxPage {Top = 0, Left = 0, Width = 1, Height = 100};

var allData = appField.ListObjectPager.IteratePages(new []{initalPage}, Pager.Next);

Anonymous
Not applicable
Author

I think height = 100 will fetch only 100 rows but I want to get all rows.

Ofcourse workaround can be get the no of rows then fetch accordingly.

But I would like to know any possibility of getting all rows for a field?

Thanks for the reply. it helps me.

Øystein_Kolsrud
Employee
Employee

That "IteratePages" call will actually fetch you all the data, but it will do so by fetching a sequence of consecutive pages, each 100 entries long. The Pager.Next method‌ ensures that each page is the next in line. (I see the documentation of that method should be more specific though...).

I assume that what you are really after is a full list of NxCell entries. To get there you could do something like this:

var allCells = allData.SelectMany(pages => pages.First().Matrix).Select(row => row.First());

By the way, I should probably have named that "allData" variable "allPages" instead. That would be more more correct description.

Another approach would be to check the cardinality of the field and then get one single big page that contains it all, but remember that the engine has a limit on the size of pages you can fetch. A page is not allowed to exceed 10 000 cells. So for big fields you will have to do some form of iterations.

Anonymous
Not applicable
Author

Thank you. But I want to execute this in java script which I am still struggling to find. Before executing in code I want to execute this in Engine API explorer.

Øystein_Kolsrud
Employee
Employee

Ah... For javascript I'm sure others can give you better guidance. But to access the data from the Engine API explorer you might want to have a look at this:

Get the values of a list object ‒ Qlik Sense