How to obtain total number of rows prior to calling TakePage

Posts   
 
    
gschwarz
User
Posts: 2
Joined: 11-Jan-2013
# Posted on: 13-Sep-2016 01:21:31   

I need to write reactive methods that return data in as an IObservable<T> in chunks by the use of IQueryable<T>.TakePage(pageNum, pageSize).Execute()

I need to loop through the pages until all rows have been returned. Since I am calling TakePage(pageNum++, pageSize) in a loop, I need to know when to break. I assume that the only way to break is to know how many pages I need to go through in advance. Is there a way to obtain the total number of rows in order to calculate the loop iterations I need to go through?

Thank you, G.Schwarz

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 13-Sep-2016 06:20:29   

Either use the Adapter's GetDBCount() or the QuerySpec's CountRow()

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 13-Sep-2016 12:50:35   

Or, break when the takepage returns < pagesize rows (as that's the last page) or 0 rows (as there are no more rows) simple_smile

Frans Bouma | Lead developer LLBLGen Pro