title: How do I set params max and offset in the List in Grails
body: <p>I am stuck at a point where i am fetching a list from domain and save it into another list. How do i pass param to the newly created list </p>
  
  <p>the code looks likes below:</p>
  
  <pre><code> params.max = Math.min(max ?: 10, 100)
          params.offset = params.offset as Integer ?: 0
  
  
  
          Calendar date = Calendar.getInstance();
          date.set(Calendar.DAY_OF_MONTH, 1);
          Calendar date2 = Calendar.getInstance();
          date2.set(Calendar.DAY_OF_MONTH, date.getActualMaximum(Calendar.DAY_OF_MONTH));
  
          def MonthStartDate =date.getTime()
          def MonthEndDate =date2.getTime()
          int monthMaxDays = MonthEndDate - MonthStartDate + 1
  
  
          Calendar cal0 = Calendar.getInstance();
          cal0.set(Calendar.DAY_OF_MONTH,1);
          Calendar cal = Calendar.getInstance();
          cal.set(Calendar.DAY_OF_MONTH,1);
       def myNewList  = new ArrayList&lt;DomainABCTYPE&gt;()
              def perDayDates = new ArrayList&lt;Date&gt;()
  
  
  
  
              for(int i=0;i&lt;monthMaxDays;i++) {
                  Date date1 = cal0.getTime();
                  cal.add(Calendar.DATE, 1);
                  Date calDate = cal.getTime();
  
  
                def myListPerDay = DomainABCTYPE.findAllByStartDateLessThanAndEndDateGreaterThanEquals(calDate, date1, params)
  
  
  
                  int k=0
                  for(;k &lt; myListPerDay .size(); k++){
                      myNewList.add(myListPerDay .get(k))
                      perDayDates.add(date1)
                      }
  
  
                  cal0.add(Calendar.DATE, 1)
  
  
              }
  
  
              render(view: "index", model:[ListInstance:myNewList ,ListCount:myNewList.size(), DatesList:perDayDates, MonthStartDate: MonthStartDate, MonthEndDate: MonthEndDate])
  
          }
  </code></pre>