• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Gorm call

 
liliya woland
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone, I'm attempting to come up with a gorm statement that would ruffly do the following:

def criteria = "where LastName starts with "+someLetter
def persons = Persons.findAllByLastName(criteria)

I'm struggling with getting the syntax right for criteria. I'm attempting to search by the first letter of all last names in my db. If anybody knows the correct syntax for my criteria combination, could you please write a response? Thanks a lot.
 
liliya woland
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found something promising, but it still not working. Right now I have:

def criteria = "from Persons as p where p.LastName like ?"
def persons = Persons.findAll(criteria, [params.selected])

It returns an empty array so far.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


 
liliya woland
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks so much, much appreciated!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic