Paging of data
The Qlik Sense .NET SDK provides classes for performing paging on hypercubes and list objects. The classes extending the DataPager class provide interfaces for traversing data from pageable objects (hypercubes and list objects).
var myListboxPager = myListbox.ListObjectPager;
You can either get the data for specific pages, move the page manually by calling the MoveCurrentPages method and then getting the data, or use the predefined convenience functions for moving across the data and retrieving the data.
Example: Get data at a specific page (the 20 top rows of column 1)
myListboxPager.GetData(new[] {new NxPage {Top = 0, Height = 20, Left = 1, Width = 1}});
Example: We can also use the current page and move to a relative position. In this case, move one column to the right.
myListboxPager.MoveCurrentPages(pages => pages.Select(page => { page.Left = page.Left + 1; return page; }));
Functions for moving pages
The Pager class provides a number of convenience functions for moving pages.
Example: Move the page manually
myListbox.MovePage(currentPages => new[] { new NxPage { Top = 0, Height = 20 } });
You can then move to a relative position compared to the current page using the Pager class
Example: Move to the next page
myListboxPager.MoveCurrentPages(Pager.Next);
Example: Move to the previous page
myListboxPager.MoveCurrentPages(Pager.Previous);
Example: Move to the first page
myListboxPager.MoveCurrentPages(Pager.First);
Example: Move to the last page
myListboxPager.MoveCurrentPages(currentPages => Pager.Last(currentPages, myListbox.Size.cy));
Moving the page implicitly
You can move the page implicitly by retrieving the next page of data using the GetData, GetFirstPage, GetNextPage, GetPreviousPage and GetLastPage methods.
Example: Retrieve data from the current page
IEnumerable<NxDataPage> currentListboxData = myListboxPager.GetData();
Example: Get the first page
IEnumerable<NxDataPage> firstDataPages = myListboxPager.GetFirstPage();
Example: Get the next page
IEnumerable<NxDataPage> nextDataPages = myListboxPager.GetNextPage();
Example: Get the previous page
IEnumerable<NxDataPage> previousDataPages = myListboxPager.GetPreviousPage();
Example: Get the last page
IEnumerable<NxDataPage> lastDataPages = myListboxPager.GetLastPage();
Example: Iterate across all pages using the Pager.Next method
IEnumerable<IEnumerable<NxDataPage>> allDataPagesNext = myListboxPager.IteratePages(new[] {first10ElementsPage}, Pager.Next);
Example: Iterate across one column at a time from left to right
Essentially reading the table like a book from left to right before going to the next row. The number of columns is for this examples assumed to be 10.
var startPages = new[] { new NxPage { Top = 0, Left = 0, Width = 1, Height = myListbox.Size.cy } }; Func <IEnumerable<NxPage>, IEnumerable<NxPage>> myPager = pages => pages.Select(page => { page.Left = page.Left + 1; return page; }); IEnumerable<IEnumerable<NxDataPage>> allDataPagesCustom = myListboxPager.IteratePages(startPages, myPager);