Here's what I have:
#iif(StructKeyExists(x.classAssign,"#y#head"),DE(x.classAssign["#y#head"]),DE(''))#
The error I get is:
Element NAMEhead is undefined in a CFML structure referenced as part of an
expression.
Since I couldn't get it working I switched it to an if/else statement and
got the effect I desired, but I don't get why the above code wouldn't work.
Even though I've moved on I'd still love to know why it's not working.
Thanks.
On Tue, Sep 7, 2010 at 4:48 PM, Raymond Camden <[email protected]> wrote:
>
> It works for me:
>
>
> <cfset x = {}>
> <cfset y = "all">
> <cfoutput>
> #iif(StructKeyExists(x,"#y#head"),DE('yes'),DE('no'))#
> </cfoutput>
> <p>
> <cfset x["allhead"] = 1>
> <cfoutput>
> #iif(StructKeyExists(x,"#y#head"),DE('yes'),DE('no'))#
> </cfoutput>
>
> I correctly get no/yes.
>
>
> On Tue, Sep 7, 2010 at 3:37 PM, Michael Grant <[email protected]> wrote:
> >
> > I know, but I want it inline of an html tag, so that's why I wanted IIF
> > instead of an if/else block.
> >
> >
> >
> > On Tue, Sep 7, 2010 at 4:15 PM, Raymond Camden <[email protected]>
> wrote:
> >
> >>
> >> This should work fine:
> >>
> >> <cfif structKeyExists(somestruct, "#y#head")>
> >>
> >>
> >> You don't need IIF at all.
> >>
> >>
> >> On Tue, Sep 7, 2010 at 3:04 PM, Michael Grant <[email protected]> wrote:
> >> >
> >> > If my var "y" = "myCell" and I want to know if the key "myCellHead"
> >> exists
> >> > in a struct how do I do it? I thought that the following would work in
> an
> >> > IIF statement but it doesn't.
> >> >
> >> > iif(StructKeyExists(x.classAssign,"#y#head"),DE('yes'),DE('no'))
> >> >
> >> > Any ideas?
> >> >
> >> >
> >> >
> >>
> >>
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336874
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm