TOP 100 rows

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
DGarza
User
Posts: 152

TOP 100 rows

Post by DGarza »

Hello everyone,

I would like to know if I can do the following, I have a view list page(db view) where I have more than 1000 rows, and each year more are added, I have set the Requires search to search by year. What I would like, if they search a year, to bring only 100 rows even if there are more.

Is there a way to limit those rows to 100?


DGarza
User
Posts: 152

Post by DGarza »

I tried to doing thiServer events->List Page->Page_Load

// Page Load event
function Page_Load()
{
    //Log("Page Load");
    $this->getSqlSelect("SELECT TOP 100 * FROM " . $this->getSqlFrom());
}

but this doesn't work


arbei
User
Posts: 9787

Post by arbei »

You get the SELECT statement, not set. You should use, e.g.

$select = $this->getQueryBuilder()->select('*')->setFirstResult(0)->setMaxResults(100);
$this->setSqlSelect($select);

Note: Above code is to show the approach only, do not just copy and paste, modify it as needed.

Also read SQL Query Builder.


DGarza
User
Posts: 152

Post by DGarza »

Thanks

I tried with this:

$select = $this->getQueryBuilder()->select('*')->from('tablename')->setFirstResult(0)->setMaxResults(100);
$this->setSqlSelect($select);

The condition of setMaxResults(100); It is not respecting it. I'm seeing that the maximum amount to display is being taken from Page Options (Global) ->Record per page
Then what I did was to remove the Use global settings and in the List page-> Records per page I put it in 0, but by defult it puts me 10, and it still does not respect the 100 that I am putting in the other.

The problem is that if I put 100 in the Records per page, it shows me the 100, but it gives me the option to go to the next page, to see the other, and I do not know how to remove that, also in the same section of Paging remove Pagin section at Top and bottom but it still shows me the bottom section.

How can i remove that section? I only want to show 100 rows and I dont want to see the pagination and nothing more.

Thank you


arbei
User
Posts: 9787

Post by arbei »

Then you may simply disable paging for that table by setting the page size to sufficiently large, see Table Specific Options.


DGarza
User
Posts: 152

Post by DGarza »

arbei wrote:

Then you may simply disable paging for that table by setting the page size to sufficiently large, see Table Specific Options.

I did it, but when a disable pagining for that table of the TOP and BOTTOM (Table Specific), It still leaves me at least the bottom one.

That I did was with css I took the class and put it display: none, I dont think that is the best way to do that, but it works


arbei
User
Posts: 9787

Post by arbei »


DGarza
User
Posts: 152

Post by DGarza »

The config that I need its Allow no paging section, its exactly that I need, thank you!


Post Reply