This has been a very interesting thread.

But the truth of the matter is that it is depending on what you intend to do
with the results.

StructFind() : Will throw an exception error if the key doesn't exist.
StructKeyExists() : will return Yes / no if the key exists or not.
Struct["Key"] : Will also throw an exception if the key doesn't exist.

Now you could always wrap a try/catch around most tags for exception
handling, but this is an expensive way of doing things.



Andrew Scott
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613  8676 4223
Mobile: 0404 998 273


-----Original Message-----
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Mark Mandel
Sent: Wednesday, 19 September 2007 9:08 AM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Cannot find key in struct.


I use StructFind() a lot - simply because I tend to encapsulate
struct's behind getter's and setters quite regualrly.

So Inside a CFC you would find me writing:

<cfset thisValue = StructFind(getStruct(), key) />

As ColdFusion doesn't support syntax like:

<cfset thisValue = getStruct()[key] />

Mark

On 9/19/07, Adam Cameron <[EMAIL PROTECTED]> wrote:
>
> > If you try and output "struct[key]" and the key doesn't exists that it
will
> > error
>
> Sure.  As with structFind().
>
> Hence my question.
>
>
> > I think maybe you have confused the meaning of your message :)
>
> Maybe.  Or maybe... not.
>
> --
> Adam
>
>
> >
>


-- 
E: [EMAIL PROTECTED]
W: www.compoundtheory.com



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to