Cfset - MACROMEDIA COLDFUSION MX 61-CFML Reference

Cfml reference
Hide thumbs Also See for COLDFUSION MX 61-CFML:
Table of Contents

Advertisement

cfset

Description
Sets a value in ColdFusion. Used to create a variable, if it does not exist, and assign it a value. Also
used to call functions.
Category
Variable manipulation tags
Syntax
<cfset
var variable_name = expression
>
See also
cfcookie, cfparam, cfregistry, cfsavecontent,
Attributes
Attribute
var
variable_name
Usage
The following sections provide detailed descriptions of some of the uses for the
Calling Functions
When you use the cfset tag to call a function, you do not need to assign the function return value
to a variable if the function does not return a value or you do not need to use the value returned
by the function. For example, the following line is a valid ColdFusion cfset tag for deleting the
MyVariable variable from the Application scope:
<cfset StructDelete(Application, "MyVariable")>
Arrays
The following example assigns a new array to the variable
<cfset months = ArrayNew(1)>
This example creates a variable
<cfset Array_Length = ArrayLen(Scores)>
This example assigns, to index position two in the array
<cfset months[2] = "February">
Dynamic variable names
In this example, the variable name is itself a variable:
<cfset myvariable = "current_value">
<cfset "#myvariable#" = 5>
318
Chapter 2: ColdFusion Tags
Req/Opt
Default
Optional
Required
Array_Length
cfschedule
Description
A keyword. Does not take a value. Identifies the
variable as being local to a function. The variable only
exists for the time of the current invocation of the
function.
Variable
:
months
that resolves to the length of the array
the value
months,
tag.
cfset
:
Scores
:
February

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents