MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference page 235

Cfml language reference
Table of Contents

Advertisement

Chapter 1: ColdFusion Tags
Example
<!--- This example illustrates the use of CFSWITCH and
CFCASE to exercise a case statement in CFML --->
<!--- query to get some information --->
<CFQUERY NAME="GetEmployees" DATASOURCE="cfsnippets">
SELECT
FROM
</CFQUERY>
<HTML>
<HEAD>
<TITLE>
CFSWITCH Example
</TITLE>
</HEAD>
<BODY bgcolor=silver>
<H3>CFSWITCH Example</H3>
<!--- By outputting the query and using CFSWITCH,
we can classify the output without using a CFLOOP construct.
--->
<CFOUTPUT QUERY="GetEmployees">
<CFSWITCH EXPRESSION=#Department#>
<!--- each time the case is fulfilled, the specific
information is printed; if the case is not fulfilled,
the default case is output --->
<CFCASE VALUE="Sales">
#FirstName# #LastName# is in <B>sales</B><BR><BR>
</CFCASE>
<CFCASE VALUE="Accounting">
#FirstName# #LastName# is in <B>accounting</B><BR><BR>
</CFCASE>
<CFCASE VALUE="Administration">
#FirstName# #LastName# is in <B>administration</B><BR><BR>
</CFCASE>
<CFDEFAULTCASE>#FirstName# #LastName# is not in Sales,
Accounting, or Administration.<BR>
</CFDEFAULTCASE>
</CFSWITCH>
</CFOUTPUT>
</BODY>
</HTML>
Emp_ID, FirstName, LastName, EMail,
Phone, Department
Employees
211

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Coldfusion 4.5

Table of Contents