Pagination issue with offset

Hi,

I have a scenario where in I am fetching records with offset and the pagination works as expected.

But based on some criteria I will be filtering the records if the condition is true. So for example in page 2 if 5 records are fetched from sql query offset and later I will be doing some filtering operations based on the true condition then the total records will be 5 - 1 which is 4.

In case if all the records matches the filter condition then the total records returned will be 5-5 which is 0.

SO my second page still displays empty page with no records to display.


Is there a way to fix this issue?


Thanks and Regards,

Ramya

Ramya Somashekaraiah wrote:

Hi,

I have a scenario where in I am fetching records with offset and the pagination works as expected.

But based on some criteria I will be filtering the records if the condition is true. So for example in page 2 if 5 records are fetched from sql query offset and later I will be doing some filtering operations based on the true condition then the total records will be 5 - 1 which is 4.

In case if all the records matches the filter condition then the total records returned will be 5-5 which is 0.

SO my second page still displays empty page with no records to display.


Is there a way to fix this issue?


Thanks and Regards,

Ramya

Hi  Ramya Somashekaraiah,

Please let me know if you use aggregate or custom sql. I think in aggregate there is a start index. You need to assign it if you are creating custom pagination. I think that will solve your problem. 

Thank you,

Sudip 


Sudip Dey wrote:

Ramya Somashekaraiah wrote:

Hi,

I have a scenario where in I am fetching records with offset and the pagination works as expected.

But based on some criteria I will be filtering the records if the condition is true. So for example in page 2 if 5 records are fetched from sql query offset and later I will be doing some filtering operations based on the true condition then the total records will be 5 - 1 which is 4.

In case if all the records matches the filter condition then the total records returned will be 5-5 which is 0.

SO my second page still displays empty page with no records to display.


Is there a way to fix this issue?


Thanks and Regards,

Ramya

Hi  Ramya Somashekaraiah,

Please let me know if you use aggregate or custom sql. I think in aggregate there is a start index. You need to assign it if you are creating custom pagination. I think that will solve your problem. 

Thank you,

Sudip 


Hi Sudip,


I am using custom SQL query with start index and offset. Problem is when I perform conditional check on the results and filter the results in foreach. 

If the results have 5 records and in foreach condition all 5 records are filtered on the basis of some Boolean condition then in pagination that specific result will be blank. Is it possible to offset the results later instead in the sql custom query after filtering records in order to avoid displaying blank results in some of the pages of the grid.




Ramya Somashekaraiah wrote:

Sudip Dey wrote:

Ramya Somashekaraiah wrote:

Hi,

I have a scenario where in I am fetching records with offset and the pagination works as expected.

But based on some criteria I will be filtering the records if the condition is true. So for example in page 2 if 5 records are fetched from sql query offset and later I will be doing some filtering operations based on the true condition then the total records will be 5 - 1 which is 4.

In case if all the records matches the filter condition then the total records returned will be 5-5 which is 0.

SO my second page still displays empty page with no records to display.


Is there a way to fix this issue?


Thanks and Regards,

Ramya

Hi  Ramya Somashekaraiah,

Please let me know if you use aggregate or custom sql. I think in aggregate there is a start index. You need to assign it if you are creating custom pagination. I think that will solve your problem. 

Thank you,

Sudip 


Hi Sudip,


I am using custom SQL query with start index and offset. Problem is when I perform conditional check on the results and filter the results in foreach. 

If the results have 5 records and in foreach condition all 5 records are filtered on the basis of some Boolean condition then in pagination that specific result will be blank. Is it possible to offset the results later instead in the sql custom query after filtering records in order to avoid displaying blank results in some of the pages of the grid.




So you need to display 1 instead of blank in the pagination block. Please let me know...


Hi Ramya,


can you tell us some more about what you are trying to achieve ?  Are you using List_Navigation from RichWidgdets ?  Can you share the query and what sorting / filtering you want to achieve ?

It sounds like you first execute a query and afterwards do some filtering on the resulting list ?? Is  there a reason why you don't incorporate the filtering inside your query ?  Is there a reason why you need to use advanced sql rather than an aggregate ?


It's hard to help if we have to guess all these details,

Dorine