Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
I am the chief technical officer at InVision App, Inc - a prototyping and collaboration platform for designers, built by designers. I also rock out in JavaScript and ColdFusion 24x7.
Meanwhile on Twitter
Loading latest tweet...
Ben Nadel at CFUNITED 2010 (Landsdown, VA) with: Michael Kassing and Simon Free

Calling Array Functions on ColdFusion Query Columns Part II

By Ben Nadel on
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,

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

... works, but the following,

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

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

  • <!--- 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.




Reader Comments

Post A Comment

You — Get Out Of My Dreams, Get Into My Comments
Live in the Now
Oops!
Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.