Depending on which versions of CF you need to support, you could do either: value = iif(structAppend( struct, { 'new_field' = 0 }, false ), de(struct.new_field), 0); or value = structAppend( struct, { 'new_field' = 0 }, false ) ? struct.new_field : 0;
As a side note, I though iif() was slow, but it's been a while since I tested it. On 12/5/12 8:31 PM, Chris Velevitch wrote: > On Thu, Dec 6, 2012 at 11:27 AM, .jonah <jonah....@creori.com> wrote: >> value = structAppend( struct, { 'new_field' = 0 }, false ); > Interesting solution, however, value needs to be struct.new_field, > structAppend returns true/false and not the resultant struct. > > I'm trying to do this inline. It would be good if structAppend return > the resultant struct so that:- > > value = structAppend( struct, { 'new_field' = 0 }, false ).new_field > > would return the passed in value or the default. > >> On 12/5/12 3:50 PM, Chris Velevitch wrote: >>> value = >>> "#iif(StructKeyExists(struct,'new_field'),Evaluate(DE('struct.new_field')),0)#" > > Chris > -- > Chris Velevitch > Manager - Adobe Platform Users Group, Sydney > m: 0415 469 095 > www.apugs.org.au > > Adobe Platform Users Group, Sydney > Topic: TBD > Date: Wednesday, 30th January at 6pm > Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353387 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm