If listClassCodes is a list of column names (stupid me for not realizing it, since it's named
listClassCodes), my example won't work exactly. You'll have to loop over the list within each record and do an Evaluate() on the list item.
A little explanation on Evaluate() is obviously in order. Consider this example:
Code:
<cfset myVar = "foo">
<cfset myVarName = "myVar">
Obviously, one way to get the value of myVar is #myVar#. But if I don't know what the name of the variable is going to be (which is the case here), I can't do that. I know that the name of the variable is stored in the variable #myVarName#, so I need a way to say to the ColdFusion engine, "Take the value of the variable 'myVarName', then evaluate that as the name of another variable". Since ColdFusion doesn't speak english, exactly, we have the Evaluate() function to tell it to do that. One way to accomplish the above example would be:
Code:
#Evaluate("#myVarName#")#
Which says (from inside out):
[ol][li]Extract the value of the variable myVarName (which is a string).[/li]
[li]Treat that string like it was the name of a variable, and get the value of that variable.[/li][/ol]
In ColdFusion documentation, this is known as
Dynamic Evaluation. There's a simpler way to write the Evaluate() function, which takes advantage of the fact that anywhere a function or expression expects a string in quotes, it will take an unquoted variable name instead:
So this evaluates not the string "myVarName", but the value of the variable "myVarName".
Hope this helps out.