Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple values in CFCASE

Status
Not open for further replies.

LongHorn

Programmer
Jun 20, 2001
30
US
Hi,
I would like to use CFCASE statement for multiple values,but don't know how. For example,

<CFCASE VALUE=&quot;Cat&quot; OR VALUE=&quot;DOG&quot; OR VALUE = &quot;BIRD&quot; >

I hate to have the same CFCASE block for each of the values.
Please advise.
Thanks.

Longhorn
 
<cfswitch expression=&quot;#url.animal#&quot;>
<cfcase value=&quot;Cat,DOG,BIRD&quot;>
Cat,DOG or BIRD
</cfcase>
<cfcase value=&quot;cow,chicken&quot;>
cow and chicken!
</cfcase>
</cfswitch>

webron
 
To use more than one value in a case, you put it in a list. Here's an example of the different ways to use CFCASE

<CFSWITCH EXPRESSION=&quot;#myPets#&quot;>
<CFCASE VALUE=&quot;Cat,Dog,Bird&quot;>
The Selected Pet is OK.
</CFCASE>
<CFCASE VALUE=&quot;Cobra|Rhinoceros|Elephant&quot; DELIMITERS=&quot;|&quot;>
The Selected Pet is DANGEROUS.
</CFCASE>
<CFCASE VALUE=&quot;Monkey&quot;>
Monkies are COOL!
</CFCASE>
<CFDEFAULTCASE>
No Pets Selected
</CFDEFAULTCASE>
</CFSWITCH>
- tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top