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 7756847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:55:39+00:00 2026-06-01T12:55:39+00:00

I am using Groovy SQL for my DB access. Very nice, but I have

  • 0

I am using Groovy SQL for my DB access. Very nice, but I have a need that I can’t find a solution for.

I see pagination supported quite nicely in the Sql class, e.g.:

sql.eachRow('select * from VENDOR', ((pageNumber-1)*pageSize)+1, pageSize) { row -> 
...
}

I also see searching/filtering like this:

def rows = sql.rows("select * from PROJECT where name like 'Gra%'")

And finally sorting (and filtering?) like this (using DataSet class):

def vemdpr = new DataSet(sql, 'VENDOR') 
def sortedVendorsOfInterest = vendor.
    findAll{ it.vendorName like '%Alpha%' }.
    sort{ it.vendorName }.reverse() //for desc order, leave off "reverse" for asc

Can anyone tell me how to combine them all to work together? I have a flexigrid that I am showing the table rows and it allows a combination of all these features.

Thanks! Mark

P.S. Barring anyone knowing how to leverage Groovy to do this (my preference), if anyone can tell me how to combine all this into an SQL query I can always just execute the query.

  • 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-06-01T12:55:41+00:00Added an answer on June 1, 2026 at 12:55 pm

    one solution would be to do it as a sql query with parameters:

    sql.eachRow('select * from VENDOR where vendorName like ? order by vendorName asc', ['%Alpha%'] ((pageNumber-1)*pageSize)+1, pageSize) { row -> 
    ...
    }
    

    Taking a look at DataSet sources shows it does not provide paging. It could be added easily by extending DataSet.rows() with the appropriated parameters offset and maxRows and modify underlying call to super.rows(getSql(), getParameters(), offset, maxRows).

    — Update —

    I’ve raised an issue on Groovy JIRA and created a pull request to solve it on Groovy project which made it into Groovy 2.0 and in Groovy 1.8.7 (not yet released). So now paging is supported at DataSet as well!

    See groovy 2.0.0 API:

    • DataSet.each(int offset, int maxRows, Closure closure)
    • DataSet.rows(int offset, int maxRows)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to print XML that I manipulated using groovy and maintain the attribute
I have a java project (not using groovy) but I'd like to interactively play
We are using grails-groovy with Hibernate, I have a SQL query like this in
I have thousands of HTML files to process using Groovy/Java and I need to
In my jmeter test, I have a BSF PreProcessor step (using groovy) running before
I am using NetBeans 7.1, which comes with Groovy 1.6 support. I have to
I'm using Grails 1.3.7 and the db-migration plug-in. I have generated a chagelog.groovy-file containing
I am using Groovy Sql to fetch results. This is the output from my
With SQLite, user defined SQL functions can easily be added using the C api
I am using groovy/grails, and I have a ResultList in my service which I

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.