Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
Ben Nadel at the New York ColdFusion User Group (May. 2009) with: Gert Franz and Peter Bell and Mark Drew
Ben Nadel at the New York ColdFusion User Group (May. 2009) with: Gert Franz@gert_railo ) , Peter Bell@peterbell ) , and Mark Drew@markdrew )

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.

Looking For A New Job?

Ooops, there are no jobs. Post one now for only $29 and own this real estate!

100% of job board revenue is donated to Kiva. Loans that change livesFind out more »

Reader Comments