Sagarmichael
Sagarmichael

Reputation: 1624

Grails if exist else within config

Some search results are being persisted to the view through config:

   Results:[
      [heading:'Id', property:'id'],
      [heading:'Title', property:'title'],
      [heading:'Status', property:'status?.value : "Awaiting value" '],
      [heading:'Timestamp', property:'timestamp']
    ]

The Status dose not work. What i am after is so is status.value does not exist then show "Awaiting value"

I am not sure what is work with :

 status?.value : "Awaiting value"

It looks fine to me any ideas?

Upvotes: 0

Views: 288

Answers (1)

tim_yates
tim_yates

Reputation: 171084

Have you tried:

  [heading:'Status', property:"${ status?.value ?: 'Awaiting value'}" ],

Upvotes: 1

Related Questions