CFSET
Use the CFSET tag to define a ColdFusion variable. If the variable already exists, CFSET resets it to the specified value.
Syntax
<CFSET variable_name=expression>
Arrays
The following example assigns a new array to the variable "months".
<CFSET months=ArrayNew(1)>
This example creates a variable "Array_Length" that resolves to the length of the array "Scores".
<CFSET Array_Length=ArrayLen(Scores)>
This example assigns to index position two in the array "months" the value "February".
<CFSET months[2]="February">
Dynamic variable names
In this example, the variable name is itself a variable.
<CFSET myvariable="current_value"> <CFSET "#myvariable#"=5>
COM objects
In this example, a COM object is created. A CFSET defines a value ...
Get Sams Teach Yourself ColdFusion® in 21 Days now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.