Installation guide
<CFSET url.mod=0>
<CFOUTPUT>#url.mod#</CFOUTPUT>
The error occurs on the CFOUTPUT, rather than the CFSET. Similarly, ColdFusion will
allow you to create and use a variable named
var (which is a keyword used within
CFSCRIPT and CFSET), but BlueDragon will not. It also fails when you try to CFOUTPUT.
So it’s not that you can never use keywords, just that you can’t always use them the same
way as in ColdFusion (and there’s no reliable documentation of how reserve words can or
cannot be used). Again, it’s best to avoid keywords as variable or function names in
CFML on both BlueDragon and ColfFusion.
3.3 Setting Variable Names Dynamically
In BlueDragon, it is not possible to create variable names dynamically by using a quoted
string, such as on the left side of the equals sign in a CFSET. Consider the following:
<CFSET hold="FirstName">
<CFSET "#hold#"="bob">
<CFOUTPUT>#FirstName#</CFOUTPUT>
In ColdFusion, this creates a new variable called FirstName and the output of the last
line is “bob”. On BlueDragon, this instead assigns “bob” to the variable
hold, and the
reference to the variable
FirstName generates a “variable-not-found” runtime error.
You can work-around this issue any of three ways (and they all apply to any variable
scope, not just the local or
variables scope). The one closest to the code above involves
simply adding the “variables” prefix within the second line before the variable name, as
in:
<CFSET hold="FirstName">
<CFSET
"variables.#hold#"="bob">
<CFOUTPUT>#FirstName#</CFOUTPUT>
Another similar variation would be to replace the second line with:
<CFSET variables[hold]=”bob")>
Still another approach is to use the
SetVariable() function. You could replace the
second line above with:
<CFSET temp = SetVariable(hold,"bob")>
or more simply:
<CFSET SetVariable(hold,"bob")>
Alternately, you could put the entire code fragment in a
CFSCRIPT, as in:
<CFSCRIPT>
hold="firstname";
setvariable(hold,"bob");
writeoutput(firstname);
</CFSCRIPT>
BlueDragon 6.1 CFML Compatibility and Reference Guide 4