Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7579649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:43:32+00:00 2026-05-30T17:43:32+00:00

I have a query which gives a result of about 100 rows. Here is

  • 0

I have a query which gives a result of about 100 rows. Here is the code for the controllers

def bandsOneTrack = {
    def bands = Band.executeQuery("Select b from Band as b where size(b.tracks) > (select count(t.id) from Band as ba join ba.tracks as t where ba.id = b.id and t.ourContract is not null) and (select count(t.id) from Band as ba join ba.tracks as t where ba.id = b.id and t.ourContract is not null) >= 1" )
    render(view: 'bands_list' , model: [ bands : bands ])
}

It gives me the result set of about 100 rows but they are appearing inside a same page.
Now I want to use pagination so that I can restrict it to only 20 rows per page.
What should I do, and also how to use pagination for this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:43:33+00:00Added an answer on May 30, 2026 at 5:43 pm

    On your pagination tag check the total parameter. That should be the total number of records. In your case 100 so that the pagination tag can calculate the total number of pages.

    Something like this here:

    <g:paginate controller="Book" action="list" total="${bookInstanceTotal}" />
    

    You might need to execute your query once to find the total number of records.

    def list() {
        params.max = Math.min(params.max ? params.int('max') : 10, 100)
        def ls = Book.executeQuery("from Book a",[max: params.max, offset: params.offset])
        def totalCount = Book.executeQuery("from Book a").size()
        [bookInstanceList: ls, bookInstanceTotal: totalCount]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following query which gives me the right results. But it's super
I have a query which returns two rows of data as count. I want
I have this query which works correctly in MySQL. More background on it here
I have a result that gives me a range of values to query from
I have the following MySQL query, which produces the result I want: SELECT `l`.`status`,
Say I have a query which returns the following result: | val | type
I have a script which allows to display search results. Given a query there
Given I have table with some data... I have a query which is used
I have this query which on executing in my sql command line client executes
I have this query which is a dependant query and taking much execution time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.