473
Views
4
Comments
Solved
Lazy load / Infinite scroll
Question

Hi All,



I want to implement lazy loading into my mobile application,

I am fetching data through a server call which returns a list of records from aggregate.

I am using on scroll ending, how can i fetch the number of records(e.g. 20), each time i scroll the list int he incremental format.

Is there any query?



Thanks,

DM

UserImage.jpg
Peter L
Solution

Hi Dhiraj,

Use a list variable to bind to the widget instead of using the SQL return list directly.

Then, you can use 

OFFSET @Skip ROWS
FETCH NEXT @Take ROWS ONLY

at the end of your SQL query, where @Skip is the number of records currently in your list variable and @Take is the number of new records you want to fetch.

So in the on lazy load action you will call the SQL, then append the returned records to the list variable.

2019-10-04 15-01-22
Dhiraj Manwani

Peter L wrote:

Hi Dhiraj,

Use a list variable to bind to the widget instead of using the SQL return list directly.

Then, you can use 

OFFSET @Skip ROWS
FETCH NEXT @Take ROWS ONLY

at the end of your SQL query, where @Skip is the number of records currently in your list variable and @Take is the number of new records you want to fetch.

So in the on lazy load action you will call the SQL, then append the returned records to the list variable.

 Thanks Peter; i used the same :)

and it worked.


Regards,

Dhiraj M.

 

2026-02-26 06-29-24
Rahul
 
MVP

Hi Dheeraj,

You need to set max record 20 , when you scrolled it will populate 20 records.

see below image


Regards

Rahul Sahu

2019-10-04 15-01-22
Dhiraj Manwani

Rahul Sahu wrote:

Hi Dheeraj,

You need to set max record 20 , when you scrolled it will populate 20 records.

see below image


Regards

Rahul Sahu

 Hi Rahul,


Thanks for quick response;

You got me wrong i think; let me be more clear

I am not asking about widget, i am asking for Aggregate or SQL query, how can i set the row count as 20 and for the next load it should get next 20 records i.e. 40 in the incremental format each time i scroll.



Thanks.

 

UserImage.jpg
Peter L
Solution

Hi Dhiraj,

Use a list variable to bind to the widget instead of using the SQL return list directly.

Then, you can use 

OFFSET @Skip ROWS
FETCH NEXT @Take ROWS ONLY

at the end of your SQL query, where @Skip is the number of records currently in your list variable and @Take is the number of new records you want to fetch.

So in the on lazy load action you will call the SQL, then append the returned records to the list variable.

2019-10-04 15-01-22
Dhiraj Manwani

Peter L wrote:

Hi Dhiraj,

Use a list variable to bind to the widget instead of using the SQL return list directly.

Then, you can use 

OFFSET @Skip ROWS
FETCH NEXT @Take ROWS ONLY

at the end of your SQL query, where @Skip is the number of records currently in your list variable and @Take is the number of new records you want to fetch.

So in the on lazy load action you will call the SQL, then append the returned records to the list variable.

 Thanks Peter; i used the same :)

and it worked.


Regards,

Dhiraj M.

 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.