This topic is locked
[SOLVED]

 Limit rows that a user can retrieve in a List Page

7/20/2020 5:41:14 PM
PHPRunner General questions
A
asawyer13 authorDevClub member

I allow the user to enter search criteria in a List page, but even if their search is going to retrieve 100 rows, I only want the user to see 10 rows. Doesn't really matter what 10 rows, but I want to limit them.
What's the easiest way to do this? I look at some of what I thought might be options, but confused myself. It doesn't need to show them that there was 100 rows, it can just show them the 10.
Thanks

Alan

fhumanes 7/26/2020

Hello:

In Mysql there is the "limit <number of rows>" clause that you want to retrieve. For example "limit 10"

Greetings,

Fernando

A
asawyer13 authorDevClub member 7/26/2020



Hello:

In Mysql there is the "limit <number of rows>" clause that you want to retrieve. For example "limit 10"

Greetings,

Fernando


In a list page I don't think I have access to the actual sql statement that's being executed to be able to add the limit clause.
I ended up using a temporary table and in the Before Process event load the temp table by creating my own sql statement and then having the list page use that temporary table. It is working well.

mbintex 7/27/2020

Look here:
https://xlinesoft.com/phprunner/docs/query_designer.htm
Search for "Limit data to first "N" rows"

A
asawyer13 authorDevClub member 7/27/2020



Look here:
https://xlinesoft.com/phprunner/docs/query_designer.htm
Search for "Limit data to first "N" rows"


Thanks, I'll check that out.

fhumanes 7/27/2020



In a list page I don't think I have access to the actual sql statement that's being executed to be able to add the limit clause.
I ended up using a temporary table and in the Before Process event load the temp table by creating my own sql statement and then having the list page use that temporary table. It is working well.


If the "limit" clause is included in a subquery, it works for me in my example.



select * from (
SELECT

idpersona,

NombreyApellidos,

persona_genero_idpersona_genero,

persona_embarazo_idpersona_embarazo,

persona_rol_idpersona_rol,

persona_activo_idpersona_activo,

proxima_revision,

DATEDIFF(proxima_revision,now()) dias_diff,

CASE

WHEN DATEDIFF(proxima_revision,now()) > 15 THEN 'En plazo'

WHEN DATEDIFF(proxima_revision,now()) <= 15 and DATEDIFF(proxima_revision,now()) >= 0 THEN 'En renovación'

WHEN DATEDIFF(proxima_revision,now()) < 0 THEN 'Está vencido'

END Estado

FROM persona limit 2) T