Howdy --
I've recently re-encountered some longstanding bugs in CF and was
wondering if there are any plans to fix these in the next version.
(1) No (sensible) method to detect whether a given array element
exists. Since IsDefined() won't do this, you have to enclose the
reference in a cftry...cfcatch construct, which is just plain silly.
Either give me an ArrayElementExists() function or, better yet, enhance
IsDefined() to support array element checking. Or, at a bare minimum,
at least note in the array documentation that the only way to do this is
cftry...cfcatch. (It ain't a bug if it's documented as a feature. :-)
I've always wondered why we aren't given an ArrayElementExists() when,
over in Structure Land, there's the handy-dandy StructKeyExists().
(2) Going all the way back to CF3, CF has forced us to code nested
query-driven loops this way:
<cfloop query="query1">
<cfset var1 = #query1.importantcolumn#>
<cfloop query="query2">
...some reference to #var1# ( in order to reference
the value of importantcolumn in the *current* row
of query1, since reference to #query1.importantcolumn#
will only get you the value of importantcolumn from
the *first* row of query1)...
</cfloop>
</cfloop>
instead of the much more logical approach that most programmers would
expect any programming language to support:
<cfloop query="query1">
<cfloop query="query2">
...references to #query1.whatever# properly
get you the value of whatever from the *current*
row of query1...
</cfloop>
</cfloop>
I know there's a tech note about this on the support site, but again,
there's nothing mentioned about this problem in the current product
documentation (and it's been there since at least CF3), it's grossly
counter-intuitive, and I don't see that it would break any existing code
(first example above) even if CF6 suddenly started doing it right
(second example above).
Thanks for listening. Just had to get these items off my chest.
-- LBA
P.S. It sure would be helpful, too, if there were an array function
that would get me a list of indices from any specified dimension of an
array (e.g., imagine an array Array1 such that Array1[1][1] = 1,
Array1[2][3] = 4 and Array1[2][5] = 6; what I'd like is a function
ArrayIndicesToList(Array1) that would return "1,2" (the list of indices
from the array's first dimension), ArrayIndicesToList(Array1[1]) would
return "1" (the only index from within the Array1[1] subarray), and
ArrayIndicesToList(Array1[2]) would return "2,5" (the indices from
within the Array1[2] subarray).
As inferred above regarding ...Exists(), does it make any sense that
there's a StructKeyList() function but no ArrayIndicesToList() function?
P.P.S. While I'm B&Ming, I might as well ask, too, why can't I cfloop
over (any given dimension of) an array? Using the example Array1 above,
<cfloop index="i" array="Array1[2]"> should send me through the loop
twice, the first time with i=3 and the second time with i=5. <cfloop
index="i" array="Array1"> should also send me through twice, the first
time with i=1, the second time with i=2.
______________________________________________________________________
Why Share?
Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists