This technique of yours, Mark, is a bit grim in my view (and it's just
that: my opinion only).
It's only relevant if one doesn't know the key name already, as one
CAN do this, quite happily:
getStruct().key
So this means it's only useful in a situation in which we're using a
runtime value for
This technique of yours, Mark, is a bit grim in my view (and it's just
that: my opinion only).
It's only relevant if one doesn't know the key name already, as one
CAN do this, quite happily:
Which is exactly where I use it. If I knew the key already, I would
have written an example like:
Hey Mark - this is pretty interesting. This is the first time I've
used a real use for structFind. Do you mind if I blog this? Or if you
do - let me know and Ill link to it.
On 9/18/07, Mark Mandel [EMAIL PROTECTED] wrote:
I use StructFind() a lot - simply because I tend to encapsulate
Ray,
Go for it, I don't mind at all :oD
Mark
On 9/20/07, Raymond Camden [EMAIL PROTECTED] wrote:
Hey Mark - this is pretty interesting. This is the first time I've
used a real use for structFind. Do you mind if I blog this? Or if you
do - let me know and Ill link to it.
On 9/18/07, Mark
On 9/17/07, Mark Mandel [EMAIL PROTECTED] wrote:
Chris - What is populating the Struct?
The struct is passed in from a Flash client using Flash Remoting.
Is it possible that the Struct has a null value against the key?
Yes, that could be possible in Flash to create a key assign it a null
Of [EMAIL PROTECTED]
Sent: Tuesday, 18 September 2007 10:04 PM
To: cfaussie
Subject: [cfaussie] Re: Cannot find key in struct.
Hi Chris
I've never quite understood why people use:
structFind(struct, key)
instead of just
struct[key]
?
I'm not sure if this would have any bearing on your issue
Hi Chris
I've never quite understood why people use:
structFind(struct, key)
instead of just
struct[key]
?
I'm not sure if this would have any bearing on your issue, but it
might be interesting to see the difference in behaviour.
--
Adam
To: cfaussie
Subject: [cfaussie] Re: Cannot find key in struct.
Hi Chris
I've never quite understood why people use:
structFind(struct, key)
instead of just
struct[key]
?
I'm not sure if this would have any bearing on your issue, but it might be
interesting to see the difference
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
--~--~-~--~~~---~--~~
You
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] /
I tried this (with CF8):
cfset myStruct = StructNew()/
cfset myStruct.key1 = Hello/
cfset myStruct.key2 = JavaCast(null, )/
cfset myStruct[key3] = JavaCast(null, )/
cfset myStruct.put( key4, JavaCast(null, ))/
cfoutput
Key1 Exists: #StructKeyExists(myStruct, key1)#br/
Key2
-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
.
www.aegeon.com.au
Phone: +613 8676 4223
Mobile: 0404 998 273
-Original Message-
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Maximilian Nyman
Sent: Wednesday, 19 September 2007 10:59 AM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Cannot find key
September 2007 10:59 AM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Cannot find key in struct.
I tried this (with CF8):
cfset myStruct = StructNew()/
cfset myStruct.key1 = Hello/
cfset myStruct.key2 = JavaCast(null, )/
cfset myStruct[key3] = JavaCast(null, )/
cfset myStruct.put
September 2007 12:30 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Cannot find key in struct.
The reason being is that Java, as I see it when defining something as NULL
is telling you that it actually doesn't exist
Andrew, I beg to differ
for me NULL tells me that it has uninitialized memory
mayve try fully scoping the variable
ARGUMENTS.pStruct
On 9/17/07, Chris Velevitch [EMAIL PROTECTED] wrote:
In the following code:-
cfif StructKeyExists(pStruct,KEY) is true
trace text=KEY found
cfset lvKEY = StructFind(pStruct,KEY)
the StructFind function
I reckon it's the diff between the name of the structure and the
structure itself for the two diff functions:
structKeyExists takes the name of the structure
try
cfif StructKeyExists(pStruct,KEY) is true
StructFind: Determines the value associated with a key in a structure.
Returns the
On 9/17/07, Barry Beattie [EMAIL PROTECTED] wrote:
try
cfif StructKeyExists(pStruct,KEY) is true
This generates an error.
It's not the StructKeyExists function that fails, it's the StructFind
and to make matters worse, it's intermittent.
Chris
--
Chris Velevitch
Manager - Sydney Flash
yeah, I just realised... I actually meant not using the name the
structfind() but that won't help either.
cfset lvKEY = StructFind(pStruct, KEY)
anyhoo:
what do you get with
cfif StructKeyExists(pStruct,KEY) is true
cfoutput#StructKeyList(pStruct)#/cfoutput
is KEY in there
Hi Chris,
is the CFC you that is calling this is a shared scope? (EG:
Application scope)
The reason I ask is because in the past I have seen things like this
because of un-vared variables.
If two threads call the CFC at the same time, it can have odd results
and/or errors.
Just a thought...
On 9/17/07, Barry Beattie [EMAIL PROTECTED] wrote:
what do you get with
cfif StructKeyExists(pStruct,KEY) is true
cfoutput#StructKeyList(pStruct)#/cfoutput
is KEY in there then?
I log a StructKeyList before the cfif and it's there.
Chris
--
Chris Velevitch
Manager - Sydney
On 9/17/07, David Harris [EMAIL PROTECTED] wrote:
is the CFC you that is calling this is a shared scope? (EG:
Application scope)
It's not a cfc, it's a cfm with a function and it's called via Flash Remoting.
Chris
--
Chris Velevitch
Manager - Sydney Flash Platform Developers Group
m: 0415
Chris,
I once had a pretty weird issue with dynamically created struct keys
that had invisible
whitespace-type special chars at the beginning/end of the string and had
similar error
messages. Have you tried to make sure that KEY (I assume that would be
a variable)
is trimmed and use the result
Chris - What is populating the Struct?
Is it possible that the Struct has a null value against the key?
If there is a null value against the key, then it's quite likely that
the StructKeyExists will return true, but the StruftFind call will
fail as described.
Mark
On 9/17/07, Chris Velevitch
24 matches
Mail list logo