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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:33:09+00:00 2026-06-01T11:33:09+00:00

params.max = Math.min(params.max ? params.int(‘max’) : 2, 100) orders=OrderInfo.createCriteria().listDistinct() For pagination, we need to

  • 0
params.max = Math.min(params.max ? params.int('max') : 2, 100)
orders=OrderInfo.createCriteria().listDistinct()

For pagination, we need to pass the params to list eg. Post.list(params). How do I pass it here? I tried but gives an error.

We also require total number which I get.
But I am not able to set params in

orders=OrderInfo.createCriteria().listDistinct()

Pls suggest the correct code

  • 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-01T11:33:10+00:00Added an answer on June 1, 2026 at 11:33 am

    If you pass the params as first parameter of the list method, you get an PagedResultList which has the method getTotalCount(). With this you could get total number of instances.

    params.max = Math.min(params.max?.toInteger() ?: 25, 100)
    params.offset = params.offset ? params.offset.toInteger() : 0
    
    def orderInfoCriteria = OrderInfo.createCriteria()
    def results = orderInfoCriteria.list(params) { // your criteria code ... }
    log.debug "Getting ${results.size()} order infos of ${results.totalCount}"
    

    Read the docs for more information about critera.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can you tell me how the expression Math.min(params.max ? params.int('max') : 10, 100) works?
in the controller params.max = Math.min(params?.max?.toInteger() ?: 10, 20) params.offset = params?.offset?.toInteger() ?: 0
I tried the following code: class Program: ProgParent { public int Max(params int[] op)
given the following code: /* signatures */ int getParams(char params[MAX_PARAM_LEN][MAX_LINE_LEN]); int getVersion(const char params[MAX_PARAM_LEN][MAX_LINE_LEN],
I have the following piece of code in ItemController.groovy def list = { params.max
I need to accomplish the following in the stored procedure: Pass parameterized column names.
Just wonder groovy way to do value matching with default like this? if(params.max !=
Inspired by Javascripts variable Arguments in Max()/Min() and list comprehension in functional languages I
I need to increase the max_allowed_packet param, to fit some theoretically very large items.
SORRY:: I forgot that params[:user_id] does not exist in the controller, using current_user.id !

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.