Calling Array Functions on ColdFusion Query Columns Part II

Posted July 26, 2006 at 9:04 AM

Tags: ColdFusion

The other day I had mentioned that someone posted a great tip about running ColdFusion array functions on query columns. After some testing I had come across the fact that column notation made a huge difference. For example,

 Launch code in new window » Download code as text file »

  • <cfset flSum = ArraySum( qGirls[ "weight" ] ) />

... works, but the following,

 Launch code in new window » Download code as text file »

  • <cfset flSum = ArraySum( qGirls.weight ) />

... throws an error. To investigate, I tried dumping out the Java classes that were representing these objects underneath:

 Launch code in new window » Download code as text file »

  • <!--- Dump out java class name. --->
  • <cfdump var="#qGirls.weight.GetClass().ToString()#" />
  •  
  • <!--- Dump out java class name. --->
  • <cfdump var="#qGirls[ 'weight' ].GetClass().ToString()#" />

It turns out that both of these ColdFusion objects are the java class "coldfusion.sql.QueryColumn". This means that on the Java side of the universe they are the same object. I don't understand exactly how ColdFusion is built on top of Java, but I guess the problem here lies in ColdFusion, before anything gets cast to Java? No idea.

Download Code Snippet ZIP File

Post Comment  |  Ask Ben  |  Permalink  |  Other Searches  |  Print Page



Learning ColdFusion 9 - ColdFusion 9 tutorials, samples, examples, demos

Reader Comments

There are no comments posted for this web log entry.


Post Comment  |  Ask Ben

Recent Blog Comments
aha
Nov 22, 2009 at 7:42 AM
Using A Name Suffix In ColdFusion's CFMail Tag
Why not? ... read »
Nov 22, 2009 at 7:37 AM
Using A Name Suffix In ColdFusion's CFMail Tag
asd ... read »
Nov 22, 2009 at 4:30 AM
jQuery Live() Method And Event Bubbling
dasegtezr ... read »
Nov 22, 2009 at 4:03 AM
jQuery Live() Method And Event Bubbling
C_fieri ... read »
Nov 22, 2009 at 1:56 AM
Learning ColdFusion 9: Using CFQuery In CFScript Can Enable SQL Injection Attacks
Why adobe would give you script equivalent of cfquery is beyond me. I love cfquery tag because it helps me wriite clean sql, and get away from the horrible jdbc queries If I wanted to write javali ... read »
Nov 22, 2009 at 1:45 AM
Streaming Text Using ColdFusion's CFContent Tag And The Variable Attribute
The reason you would want to do this is to stream. Ack json/xml files to ria clients I used thus technique before because putting json in response stream causes debugging info to come thru As well a ... read »
Nov 21, 2009 at 6:47 PM
Hal Helms - Real World Object Oriented Development, Sarasota - Day Five
@charlie griefer, Thank you.. ... read »
Nov 21, 2009 at 5:15 PM
Using ColdFusion Structures To Remove Duplicate List Values
@Jose Galdamez, Oh heh yeah I didn't paste the whole code. I should have defined the vars -- my bad. It's fixed thou. Thanks. ... read »