Lawrence B. Afrin, M.D. wrote:
>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>
>
try this...
<cfloop index="qry1_row" from="1" to="#qry1.recordcount#">
<cfloop index="qry2_row" from="1" to="#qry2.recordcount#">
<cfoutput>#qry1.name[qry1_row]# #qry2.name[qry2_row]#</cfoutput>
</cfloop>
</cfloop>
<cfoutput query="qry1">
<cfset qry1_row=qry1_row.currentrow>
<cfoutput query="qry2">
<cfset qry2_row=qry2_row.currentrow> <!--- no reaaly needed buit
makes things clearer --->
#qry1.name[qry1_row]# #qry2.name[qry2_row]#
</cfoutput>
</cfoutput>
it's done like this because there are too many ways to nest stuff and
then it can get very confusing to know which point you are at.... it's a
performance trade off ( CF could do everything, but then it would be
slow), but at least you know whats going on... the first one is also
nice becuase you don't end up with lots a white space if you
cfprocesessingdirectives
______________________________________________________________________
Get Your Own Dedicated Windows 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=coldfusionb
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