views:

25

answers:

2

Hello again,

so, Grails is making me feel quite stupid again, I'm new to this. I have A grails domain that maps a table thats in production on a postgresql database. I am trying to track progress on the project by a date field 'migratedDate'. Everytime a process takes place the field is timestamped.

I can't seem to make a controller that populates a map with only non-null values. Everything I've tried is returning all records to the view. What can I add to say:

def list3 = {
    [tape : Tapes.list(sort:"migratedDate", order:"asc")]
}

so that the controller can remove any records where 'migratedDate' is null

I'm sure I'm missing something simple.

Thanks!

A: 

Try this:

def myAction = {
    def c = Tape.createCriteria()
    def tapes = c.list(sort: 'migratedDate', order: 'asc') {
        isNotNull('migratedDate')
    }
    [tape: tapes]
}
Rob Hruska
Thanks! I also found a problem with my <g:if> tag.
awfulHack
A: 

With Dynamic Finders

def list3 = {
    [tape : Tapes.findAllByMigratedDateIsNotNull([sort:"migratedDate", order:"asc"])]
}
Aaron Saunders