Should be

<cfset aStruct=StructNew()>
<cfset aStruct.aField="something">
<cfif structKeyExists(aStruct,"afield")>
aStruct[aField] is defined
</cfif>



"Success is a journey, not a destination!!"



Doug Brown
----- Original Message -----
From: "Rob Baxter" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, April 18, 2002 9:04 AM
Subject: RE: IsDefined and brackets


> I believe that IsDefined is only meant to check for the existance of top
> level variables, for complex data types you have to use the specific
> functions for each type. So here CF is trying to find out if there is a
> variable named "aStruct[aField]" and brackets are illegal in cf variable
> names.
>
> In this case I think you'll have to do a 3 step process:
>
> <cfif IsDefined("aStruct") And IsStruct(aStruct) And StuctKeyExists(aStruct,
> "aField")>
> ..
> </cfif>
>
>
> </rob>
>
> -----Original Message-----
> From: cf refactoring [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 18, 2002 11:50 AM
> To: CF-Talk
> Subject: IsDefined and brackets
>
>
> The following code throws a syntax error:
>
> <cfset aStruct=StructNew()>
> <cfset aStruct.aField="something">
> <cfif IsDefined("aStruct[aField]")>
> aStruct[aField] is defined
> </cfif>
>
> Is this just some CF quirk that IsDefined doesn't like
> brackets or is there some good reason for this?
>
> =====
> I-Lin Kuo
> Macromedia CF5 Advanced Developer
> Sun Certified Java 2 Programmer
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/
>
> 
______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to