Cfswitch - MACROMEDIA COLDFUSION MX 61-CFML Reference

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

Advertisement

cfswitch

Description
Evaluates a passed expression and passes control to the
result. You can, optionally, code a
matching
cfcase
Category
Flow-control tags
Syntax
<cfswitch
expression = "expression">
one or more cfcase tags
zero or one cfdefaultcase tags
</cfswitch>
See also
cfcase,
cfdefaultcase
also
cfabort, cfloop, cfbreak, cfrethrow, cfexecute, cfexit, cfthrow, cfif,
cftry,
cflocation
History
ColdFusion MX: Changed
cfdefaultcase
item.
Attributes
Attribute
Req/Opt
expression
Required
Usage
This tag requires an end tag. All code within this tag must be within a
tag. Otherwise, ColdFusion throws an error.
Use this tag followed by one or more
tag selects the matching alternative from the
matching tag, and executes the code between the
The
tag provides better performance than a series of
cfswitch
is easier to read.
Example
<!--- This example shows the use of cfswitch and cfcase to
exercise a case statement in CFML --->
<cfquery name = "GetEmployees" dataSource = "cfsnippets">
SELECT Emp_ID, FirstName, LastName, EMail, Phone, Department
FROM
Employees
</cfquery>
<h3>cfswitch Example</h3>
330
Chapter 2: ColdFusion Tags
cfdefaultcase
tag value.
cfdefaultcase
tag at any position within a
Default
Description
ColdFusion expression that yields a scalar value. ColdFusion
converts integers, real numbers, Booleans, and dates to
numeric values. For example, True, 1, and 1.0 are all equal.
cfcase
tag that matches the expression
cfcase
tag, which receives control if there is no
tag placement requirements: you can put the
statement; it is not required to be the last
cfswitch
tags. Optionally, include a
and
cfcase
cfdefaultcase
start and end tags.
cfcase
cfif
or
cfcase
cfdefaultcase
tag. This
cfdefaultcase
tags, jumps to the
/
tags, and the code
cfelseif

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents