Glad to help. Thanks for the update.
/charlie
From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf
Of Gavin Baumanis
Sent: Wednesday, January 11, 2012 12:14 AM
To: cfaussie@googlegroups.com
Subject: Re: [cfaussie] Count the number of arguments passed into a
function.
Hi All,
Just to follow up on this - now that I am back to working on this issue...
And, not that I ever doubted Charlie... but a some working code is worth a
thousand words...
cffunction name=blah
cfargument name=messageid required=false /
cfargument name=text required=false /
I'll repeat, in case the point was missed: if the concern here is that
structkeyexists doesn't do the job, note again that the arguments struct can
be treated as an array as well as a struct. And the arrayisdefined function
(new since 8) can test for the existence (or not) of an element in the
Hey Bau Co, this one's been bending my brain for a few hours now. It's an
interesting thread I read it lots. Please excuse me for just rambling a
bit, so I can sleep tonight.
@Dale
I agree StructKeyExists will return false when the key exists, but the
value is null, ie;
cfset
Yeah, so do you agree structkeyexist should return true for that key?
It exists, but it's not defined.
On 06/01/2012, at 13:25, Dale Fraser d...@fraser.id.au wrote:
But the key to the struct exists J I can dump it.
Regards
Dale Fraser
http://dale.fraser.id.au
http://cfmldocs.com
Well I originally said no because
Accessing it other ways fails
But it's clearly there, it needs to be consistant
The name of structKeyExists is perhaps wrong, because it really releates to
the data, not the key.
Regards
Dale Fraser
http://dale.fraser.id.au
Unfortunately it's too late to strive for consistency at this point.
The odd behaviour of structKeyExists is due to the underlying Java
implementation, the inconsistent handling of null values in Adobe CFML, and
backwards compatibility concerns.
CF structs are special Java objects that implement
It looks like you trying to access a property ( messageId ) of the instance with
cfif structKeyExists(messageCFC, messageid)
presuming messageCFC is an instance of message ?
Paul
On 5/01/2012 3:54 PM, Gavin Baumanis wrote:
Hi there,
Let me explain what I am trying to do,
the executive
Take this simple example, there is clearly a bug in some of these CF
functions
cfset test(1, 2) /
cffunction name=test
cfargument name=a1 /
cfargument name=a2 /
cfargument name=a3 /
cfargument name=a4 /
cfoutput#structCount(arguments)#/cfoutput
Hi Paul,
Bad copy / pasting
messageCFC = myTestCFC - sorry.
cfif structKeyExists(messageCFC, messageid)
should be
cfif structKeyExists(myTestCFC, messageid)
On Thursday, January 5, 2012 4:11:54 PM UTC+11, Paul Kukiel wrote:
It looks like you trying to access a property (
I see what your saying now. Yeah seams wierd
Paul
On 5/01/2012 4:29 PM, Dale Fraser wrote:
Take this simple example, there is clearly a bug in some of these CF
functions
cfsettest(1, 2) /
cffunctionname=test
cfargument name=a1 /
cfargument name=a2 /
cfargument name=a3 /
cfargument
This however works
cfset test(1, 2) /
cffunction name=test
cfoutput#structCount(arguments)#/cfoutput
cfdump var=#arguments# /
cfoutput#structKeyExists(arguments, 'a3')#/cfoutput
/cffunction
OUTPUTS
2
struct
1
1
2
2
NO
So it seems that
Yep, that's an interesting challenge, Gavin. (And if anyone may have read
only the first sentence of his note and not the rest, note that he IS
already counting the arguments struct, but the issue is that because he's
using cfargument to define them, even without any default, all those defined
I think it's a bug one way or another and Adobe should fix it.
structCount is INCORRECT imo shows 4 elements
dump is INCORRECT imo shows 4 elements
structKeyExists is CORRECT. It doesn't think its there.
Anything else you try to do to those elements, think it doesn't exists thus
the first 2
I trust you've logged that bug?
Cheers
Kai
I think it's a bug one way or another and Adobe should fix it.
structCount is INCORRECT imo shows 4 elements
dump is INCORRECT imo shows 4 elements
structKeyExists is CORRECT. It doesn't think its there.
Anything else you try to do to those
Here's a silly but funny way to do it:
#structCount(arguments) - (listLen(SerializeJSON(arguments),null) - 1)#
Dale, with your example, it goes 4 - (3-1) = 2 actual elements.
Tof
On Thu, Jan 5, 2012 at 5:21 PM, Kai Koenig k...@koeni.de wrote:
I trust you've logged that bug?
Cheers
Kai
16 matches
Mail list logo