multiple case values in switch statement in cfscript

2002-10-10 Thread Kola Oyedeji

Hi

Could anyone tell me if its possible to define multiple case statements
In a switch block in cfscript..

So a cfscript version of :

cfcase = a,b,c,d,e 


Thanks

Kola


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com



Re: multiple case values in switch statement in cfscript

2002-10-10 Thread Gyrus

- Original Message -
 Could anyone tell me if its possible to define multiple case statements
 In a switch block in cfscript..
---

I don't think this is possible. If you get an error when you try it, that
would confirm things :-)  I think it might be to do with CFScript being kept
as close as possible to JavaScript. Use cfswitch if necessary...

Gyrus
[EMAIL PROTECTED]
work: http://www.tengai.co.uk
play: http://www.norlonto.net
PGP key available

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.



RE: multiple case values in switch statement in cfscript

2002-10-10 Thread Mark A. Kruger - CFG

No it is not.  Each case must be listed individually.  If you really must
use a single case for multiple values you will have to move to tag syntax
(cfswitch).

-Original Message-
From: Kola Oyedeji [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 10, 2002 11:11 AM
To: CF-Talk
Subject: multiple case values in switch statement in cfscript


Hi

Could anyone tell me if its possible to define multiple case statements
In a switch block in cfscript..

So a cfscript version of :

cfcase = a,b,c,d,e 


Thanks

Kola



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm



RE: multiple case values in switch statement in cfscript

2002-10-10 Thread Rob Rohan

cfcase = a,b,c,d,e delimiters=,

-Original Message-
From: Kola Oyedeji [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 10, 2002 9:11 AM
To: CF-Talk
Subject: multiple case values in switch statement in cfscript


Hi

Could anyone tell me if its possible to define multiple case statements
In a switch block in cfscript..

So a cfscript version of :

cfcase = a,b,c,d,e 


Thanks

Kola



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm



Re: multiple case values in switch statement in cfscript

2002-10-10 Thread Nick Han

Don't think it's possible to specify a list like that  with cfscript.  You would need 
five different case statements.
Not sure whether you can do this in cfmx.

Nick Han

 [EMAIL PROTECTED] 10/10/02 09:11AM 
Hi

Could anyone tell me if its possible to define multiple case statements
In a switch block in cfscript..

So a cfscript version of :

cfcase = a,b,c,d,e 


Thanks

Kola



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com



Re: multiple case values in switch statement in cfscript

2002-10-10 Thread Jochem van Dieten

Kola Oyedeji wrote:
 
 So a cfscript version of :
 
 cfcase = a,b,c,d,e 

switch(name) {
 case Xander:
 case Oz:
 case Angel:
 {
 male=true;
 break;
 }
 case Tara:
 case Willow:
 case Cordelia:
 {
 male=false;
 break;
 }
 }

Jochem

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com



RE: multiple case values in switch statement in cfscript

2002-10-10 Thread Bryan Love

yes, but not exactly as you hoped...

Keep in mind that when a case evaluates to true, CF will execute EVERYTHING
until it finds a break statement...

so this would do what you want...

cfscript
switch( someVal ){
case a:
case b:
case c:
case d:
case e:
[execute some code]
break;
}

+---+
Bryan Love
  Macromedia Certified Professional
  Internet Application Developer
  Database Analyst
TeleCommunication Systems
[EMAIL PROTECTED]
+---+

...'If there must be trouble, let it be in my day, that my child may have
peace'...
- Thomas Paine, The American Crisis

Let's Roll
- Todd Beamer, Flight 93



-Original Message-
From: Kola Oyedeji [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 10, 2002 9:11 AM
To: CF-Talk
Subject: multiple case values in switch statement in cfscript


Hi

Could anyone tell me if its possible to define multiple case statements
In a switch block in cfscript..

So a cfscript version of :

cfcase = a,b,c,d,e 


Thanks

Kola



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.



RE: multiple case values in switch statement in cfscript

2002-10-10 Thread Rob Rohan

Woops! sorry didn't see the in cfscript part.

Guessing...

switch(#variabel#){
case a:
stuff
case b:
otherstuff
case c:
morestuff
break;

case q:
asdfasdf
break;
}

if that doesn't work, then it wont work.

-Original Message-
From: Rob Rohan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 10, 2002 10:13 AM
To: CF-Talk
Subject: RE: multiple case values in switch statement in cfscript


cfcase = a,b,c,d,e delimiters=,

-Original Message-
From: Kola Oyedeji [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 10, 2002 9:11 AM
To: CF-Talk
Subject: multiple case values in switch statement in cfscript


Hi

Could anyone tell me if its possible to define multiple case statements
In a switch block in cfscript..

So a cfscript version of :

cfcase = a,b,c,d,e 


Thanks

Kola




~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm



Re: multiple case values in switch statement in cfscript

2002-10-10 Thread S . Isaac Dealey

 Hi

 Could anyone tell me if its possible to define multiple case statements
 In a switch block in cfscript..

 So a cfscript version of :

 cfcase = a,b,c,d,e 


Yes it is.

CFScript uses standard C/C++/Java/JavaScript syntax for switch/case, so the
cfscript equivalent looks like this:

switch (exp) {
case a: { ; }
case b: { .. do something ... }
case c: { .. do something ... break; }
default: { ... do something ... }
}

The case expressions cascade, so from the point that your case evaluates, to
the point that you insert a break; in your case statements is what portion
of the code will execute, thus, if the value of exp is a or b, in the
example above, all of the actions ( or lack thereof in the case of a ) will
occur for cases a,b and c. If the value of exp is c then only the action for
c will occur. The default actions will not be processed unless something
other than a b or c is found in the value of exp because of the break; at
the end of the actions for c.

hth

S. Isaac Dealey
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm



Re: multiple case values in switch statement in cfscript

2002-10-10 Thread S . Isaac Dealey

 - Original Message -
 Could anyone tell me if its possible to define multiple case statements
 In a switch block in cfscript..
 ---

 I don't think this is possible. If you get an error when you try it, that
 would confirm things :-)  I think it might be to do with CFScript being
 kept as close as possible to JavaScript. Use cfswitch if necessary...

No it's definitely doable ( see my previous message ) -- it's just that the
syntax is _very_ different.

S. Isaac Dealey
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com



RE: multiple case values in switch statement in cfscript

2002-10-10 Thread S . Isaac Dealey

Nope -- you can include empty case statements without a break; and they will
cascade down into the following case statements until it finds a break; It's
definitely doable ( see my previous post ), it's just that the syntax is
_very_ different.

S. Isaac Dealey
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

 No it is not.  Each case must be listed individually.  If you really must
 use a single case for multiple values you will have to move to tag syntax
 (cfswitch).

 -Original Message-
 From: Kola Oyedeji [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, October 10, 2002 11:11 AM
 To: CF-Talk
 Subject: multiple case values in switch statement in cfscript


 Hi

 Could anyone tell me if its possible to define multiple case statements
 In a switch block in cfscript..

 So a cfscript version of :

 cfcase = a,b,c,d,e 


 Thanks

 Kola



 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.



RE: multiple case values in switch statement in cfscript

2002-10-10 Thread Fitch, Tyler

One option might be to selectively use your break; command in the switch
statement.

If muliple cases can do the same code try

cfscript
switch (theVar){
case val1:{
setAVar = 'it was case 1';
break;
}
case val2:
case val3:{
setAVar = 'it was case 2 or 3'; 
break;
}
case val4:{
setAVar = 'it was case 4';  
break;
}
}
/cfscript

I _think_ from what I remember reading that it'll keep processing until
it hits a break;

Their might be a cleaner way to implement the case statements too, but
it works from my quick tests.

t

**
Tyler M. Fitch
Certified Advanced ColdFusion 5 Developer

http://isitedesign.com
**

-Original Message-
From: Gyrus [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, October 10, 2002 9:56 AM
To: CF-Talk
Subject: Re: multiple case values in switch statement in cfscript


- Original Message -
 Could anyone tell me if its possible to define multiple case 
 statements In a switch block in cfscript..
---

I don't think this is possible. If you get an error when you try it,
that would confirm things :-)  I think it might be to do with CFScript
being kept as close as possible to JavaScript. Use cfswitch if
necessary...

Gyrus
[EMAIL PROTECTED]
work: http://www.tengai.co.uk
play: http://www.norlonto.net
PGP key available


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm



RE: multiple case values in switch statement in cfscript

2002-10-10 Thread Mark A. Kruger - CFG

Sir Isaac - I bow to your wisdom.  I have never seen it in that context.

-Original Message-
From: S. Isaac Dealey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 10, 2002 12:59 PM
To: CF-Talk
Subject: Re: multiple case values in switch statement in cfscript


 Hi

 Could anyone tell me if its possible to define multiple case statements
 In a switch block in cfscript..

 So a cfscript version of :

 cfcase = a,b,c,d,e 


Yes it is.

CFScript uses standard C/C++/Java/JavaScript syntax for switch/case, so the
cfscript equivalent looks like this:

switch (exp) {
case a: { ; }
case b: { .. do something ... }
case c: { .. do something ... break; }
default: { ... do something ... }
}

The case expressions cascade, so from the point that your case evaluates, to
the point that you insert a break; in your case statements is what portion
of the code will execute, thus, if the value of exp is a or b, in the
example above, all of the actions ( or lack thereof in the case of a ) will
occur for cases a,b and c. If the value of exp is c then only the action for
c will occur. The default actions will not be processed unless something
other than a b or c is found in the value of exp because of the break; at
the end of the actions for c.

hth

S. Isaac Dealey
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm



RE: multiple case values in switch statement in cfscript

2002-10-10 Thread S . Isaac Dealey

Please, no pictures. :P

It's just once around the block in c++ land. :)

I taught myself c++ a few months before I got into CF thinking it would help
me get a good job... Since then I've never been asked to do anthing but CF,
ASP and JavaScript. But when I started working with CF I was thinking
something similar about cfswitch -- So, how do I cascade my case
statements??? ... :P

And technically, the cfscript syntax gives you more control.

 Sir Isaac - I bow to your wisdom.  I have never seen it in
 that context.

 -Original Message-
 From: S. Isaac Dealey [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, October 10, 2002 12:59 PM
 To: CF-Talk
 Subject: Re: multiple case values in switch statement in
 cfscript


 Hi

 Could anyone tell me if its possible to define multiple
 case statements
 In a switch block in cfscript..

 So a cfscript version of :

 cfcase = a,b,c,d,e 


 Yes it is.

 CFScript uses standard C/C++/Java/JavaScript syntax for
 switch/case, so the
 cfscript equivalent looks like this:

 switch (exp) {
   case a: { ; }
   case b: { .. do something ... }
   case c: { .. do something ... break; }
   default: { ... do something ... }
 }

 The case expressions cascade, so from the point that your
 case evaluates, to
 the point that you insert a break; in your case statements
 is what portion
 of the code will execute, thus, if the value of exp is a
 or b, in the
 example above, all of the actions ( or lack thereof in the
 case of a ) will
 occur for cases a,b and c. If the value of exp is c then
 only the action for
 c will occur. The default actions will not be processed
 unless something
 other than a b or c is found in the value of exp because
 of the break; at
 the end of the actions for c.

 hth

 S. Isaac Dealey
 Certified Advanced ColdFusion 5 Developer

 www.turnkey.to
 954-776-0046

 ~~
 ~~~|
 Archives:
 http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
 Subscription: http://www.houseoffusion.com/index.cfm?sideb
 ar=listsbody=lists/cf_talk
 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
 Structure your ColdFusion code with Fusebox. Get the
 official book at http://www.fusionauthority.com/bkinfo.cfm


Isaac
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm



Switch Statement in CFSCRIPT

2000-08-24 Thread FWA

This is a multi-part message in MIME format.

--=_NextPart_000_0015_01C00DBB.414D3C00
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I am having a problem with switch statement in a cfscript block.  It is =
always executing the last case, no matter what happens.  I have tried =
several different things and none of them seem to work.  I have checked =
that the switch expression is one of the cases and the statement seems =
to disregard the variable.  Any ideas?


I have done this with and without #'s around result and with and without =
the { } in the cases.   THANK YOU!!


switch (#result#) {
case 0:
{
a =3D "u";
f =3D "webbox";
o =3D url.webreq;
if(q.accref is 'A') {
page =3D "editacc";
}
else {
page =3D "editref";
}
file =3D "editboxd.cfm";
}
case 2:
{
a =3D "i";
f =3D "webbox";
o =3D url.webreq;
page =3D "warn";
file =3D "editboxd.cfm5";
}
}

--=_NextPart_000_0015_01C00DBB.414D3C00
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
HTMLHEAD
META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1"
META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR
STYLE/STYLE
/HEAD
BODY bgColor=3D#ff
DIVFONT face=3DArial size=3D2I am having a problem with switch =
statement in a=20
cfscript block.nbsp; It is always executing the last case, no matter =
what=20
happens.nbsp; I have tried several different things and none of them =
seem to=20
work.nbsp; I have checked that the switch expression is one of the =
cases and=20
the statement seems to disregard the variable.nbsp; Any =
ideas?/FONT/DIV
DIVFONT face=3DArial size=3D2/FONTnbsp;/DIV
DIVFONT face=3DArial size=3D2/FONTnbsp;/DIV
DIVFONT face=3DArial size=3D2I have done this with and without #'s =
around result=20
and with and without the { } in the cases.nbsp;nbsp; THANK =
YOU!!/FONT/DIV
DIVFONT face=3DArial size=3D2/FONTnbsp;/DIV
DIVFONT face=3DArial size=3D2/FONTnbsp;/DIV
DIVFONT face=3DArial size=3D2switch (#result#)=20
{BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; case=20
0:BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=20
{BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; =
a =3D=20
"u";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp=
; f =3D=20
"webbox";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=
nbsp;=20
o =3D=20
url.webreq;BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbs=
p;nbsp;=20
if(q.accref is 'A')=20
{BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;n=
bsp;nbsp;nbsp;nbsp;=20
page =3D=20
"editacc";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp=
;nbsp;=20
}BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; =
else=20
{BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;n=
bsp;nbsp;nbsp;nbsp;=20
page =3D=20
"editref";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp=
;nbsp;=20
}BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; =
file =3D=20
"editboxd.cfm";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=20
}BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; case=20
2:BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=20
{BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; =
a =3D=20
"i";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp=
; f =3D=20
"webbox";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=
nbsp;=20
o =3D=20
url.webreq;BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbs=
p;nbsp;=20
page =3D=20
"warn";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;n=
bsp;=20
file =3D "editboxd.cfm5";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=20
}/FONT/DIV
DIVFONT face=3DArial size=3D2}/FONT/DIV/BODY/HTML

--=_NextPart_000_0015_01C00DBB.414D3C00--

--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: Switch Statement in CFSCRIPT

2000-08-24 Thread Don Vawter

You need a "break" command at the end of each case
- Original Message -
From: "FWA" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 24, 2000 9:05 AM
Subject: Switch Statement in CFSCRIPT


 This is a multi-part message in MIME format.

 --=_NextPart_000_0015_01C00DBB.414D3C00
 Content-Type: text/plain;
 charset="iso-8859-1"
 Content-Transfer-Encoding: quoted-printable

 I am having a problem with switch statement in a cfscript block.  It is =
 always executing the last case, no matter what happens.  I have tried =
 several different things and none of them seem to work.  I have checked =
 that the switch expression is one of the cases and the statement seems =
 to disregard the variable.  Any ideas?


 I have done this with and without #'s around result and with and without =
 the { } in the cases.   THANK YOU!!


 switch (#result#) {
 case 0:
 {
 a =3D "u";
 f =3D "webbox";
 o =3D url.webreq;
 if(q.accref is 'A') {
 page =3D "editacc";
 }
 else {
 page =3D "editref";
 }
 file =3D "editboxd.cfm";
 }
 case 2:
 {
 a =3D "i";
 f =3D "webbox";
 o =3D url.webreq;
 page =3D "warn";
 file =3D "editboxd.cfm5";
 }
 }

 --=_NextPart_000_0015_01C00DBB.414D3C00
 Content-Type: text/html;
 charset="iso-8859-1"
 Content-Transfer-Encoding: quoted-printable

 !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
 HTMLHEAD
 META http-equiv=3DContent-Type content=3D"text/html; =
 charset=3Diso-8859-1"
 META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR
 STYLE/STYLE
 /HEAD
 BODY bgColor=3D#ff
 DIVFONT face=3DArial size=3D2I am having a problem with switch =
 statement in a=20
 cfscript block.nbsp; It is always executing the last case, no matter =
 what=20
 happens.nbsp; I have tried several different things and none of them =
 seem to=20
 work.nbsp; I have checked that the switch expression is one of the =
 cases and=20
 the statement seems to disregard the variable.nbsp; Any =
 ideas?/FONT/DIV
 DIVFONT face=3DArial size=3D2/FONTnbsp;/DIV
 DIVFONT face=3DArial size=3D2/FONTnbsp;/DIV
 DIVFONT face=3DArial size=3D2I have done this with and without #'s =
 around result=20
 and with and without the { } in the cases.nbsp;nbsp; THANK =
 YOU!!/FONT/DIV
 DIVFONT face=3DArial size=3D2/FONTnbsp;/DIV
 DIVFONT face=3DArial size=3D2/FONTnbsp;/DIV
 DIVFONT face=3DArial size=3D2switch (#result#)=20
 {BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; case=20
 0:BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=20
 {BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; =
 a =3D=20
 "u";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp=
 ; f =3D=20
 "webbox";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=
 nbsp;=20
 o =3D=20
 url.webreq;BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbs=
 p;nbsp;=20
 if(q.accref is 'A')=20
 {BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;n=
 bsp;nbsp;nbsp;nbsp;=20
 page =3D=20
 "editacc";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp=
 ;nbsp;=20
 }BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; =
 else=20
 {BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;n=
 bsp;nbsp;nbsp;nbsp;=20
 page =3D=20
 "editref";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp=
 ;nbsp;=20
 }BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; =
 file =3D=20
 "editboxd.cfm";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=20
 }BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; case=20
 2:BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=20
 {BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; =
 a =3D=20
 "i";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp=
 ; f =3D=20
 "webbox";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=
 nbsp;=20
 o =3D=20
 url.webreq;BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbs=
 p;nbsp;=20
 page =3D=20
 "warn";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;n=
 bsp;=20
 file =3D "editboxd.cfm5";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=20
 }/FONT/DIV
 DIVFONT face=3DArial size=3D2}/FONT/DIV/BODY/HTML

 --=_NextPart_000_0015_01C00DBB.414D3C00--

 --

 Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
 To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: Switch Statement in CFSCRIPT

2000-08-24 Thread dave fauth

You need break after each case:

case 0:
  {

  }
break;
case 1:
  {
  }
break;

etc...

RE:
I am having a problem with switch statement in a cfscript block.  It is =
always executing the last case, no matter what happens.  I have tried =
several different things and none of them seem to work.  I have checked =
that the switch expression is one of the cases and the statement seems =
to disregard the variable.  Any ideas?

---
dave fauth
[EMAIL PROTECTED]

"The opinions expressed here
are my own and not those of 
DOMAIN technologies, inc."
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: Switch Statement in CFSCRIPT

2000-08-24 Thread Sharon DiOrio

Hi,

You were missing quotes around the case values and "breaks" in the case.
This should work:

switch (result) {
case "0":
{
a = "u";
f = "webbox";
o = url.webreq;
if(q.accref is 'A') {
page = "editacc";
}
else {
page = "editref";
}
file = "editboxd.cfm";
   break;
}
case "2":
{
a = "i";
f = "webbox";
o = url.webreq;
page = "warn";
file = "editboxd.cfm5";
 break;
  }
}

HTH!
Sharon
-Original Message-----
From: FWA [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Friday, August 25, 2000 12:42 PM
Subject: Switch Statement in CFSCRIPT


This is a multi-part message in MIME format.

--=_NextPart_000_0015_01C00DBB.414D3C00
Content-Type: text/plain;
 charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I am having a problem with switch statement in a cfscript block.  It is =
always executing the last case, no matter what happens.  I have tried =
several different things and none of them seem to work.  I have checked =
that the switch expression is one of the cases and the statement seems =
to disregard the variable.  Any ideas?


I have done this with and without #'s around result and with and without =
the { } in the cases.   THANK YOU!!


switch (#result#) {
case 0:
{
a =3D "u";
f =3D "webbox";
o =3D url.webreq;
if(q.accref is 'A') {
page =3D "editacc";
}
else {
page =3D "editref";
}
file =3D "editboxd.cfm";
}
case 2:
{
a =3D "i";
f =3D "webbox";
o =3D url.webreq;
page =3D "warn";
file =3D "editboxd.cfm5";
}
}

--=_NextPart_000_0015_01C00DBB.414D3C00
Content-Type: text/html;
 charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
HTMLHEAD
META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1"
META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR
STYLE/STYLE
/HEAD
BODY bgColor=3D#ff
DIVFONT face=3DArial size=3D2I am having a problem with switch =
statement in a=20
cfscript block.nbsp; It is always executing the last case, no matter =
what=20
happens.nbsp; I have tried several different things and none of them =
seem to=20
work.nbsp; I have checked that the switch expression is one of the =
cases and=20
the statement seems to disregard the variable.nbsp; Any =
ideas?/FONT/DIV
DIVFONT face=3DArial size=3D2/FONTnbsp;/DIV
DIVFONT face=3DArial size=3D2/FONTnbsp;/DIV
DIVFONT face=3DArial size=3D2I have done this with and without #'s =
around result=20
and with and without the { } in the cases.nbsp;nbsp; THANK =
YOU!!/FONT/DIV
DIVFONT face=3DArial size=3D2/FONTnbsp;/DIV
DIVFONT face=3DArial size=3D2/FONTnbsp;/DIV
DIVFONT face=3DArial size=3D2switch (#result#)=20
{BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; case=20
0:BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=20
{BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; =
a =3D=20
"u";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp=
; f =3D=20
"webbox";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=
nbsp;=20
o =3D=20
url.webreq;BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbs=
p;nbsp;=20
if(q.accref is 'A')=20
{BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;n=
bsp;nbsp;nbsp;nbsp;=20
page =3D=20
"editacc";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp=
;nbsp;=20
}BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; =
else=20
{BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;n=
bsp;nbsp;nbsp;nbsp;=20
page =3D=20
"editref";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp=
;nbsp;=20
}BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; =
file =3D=20
"editboxd.cfm";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=20
}BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; case=20
2:BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=20
{BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; =
a =3D=20
"i";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp=
; f =3D=20
"webbox";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=
nbsp;=20
o =3D=20
url.webreq;BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbs=
p;nbsp;=20
page =3D=20
"warn";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;n=
bsp;=20
file =3D "editboxd.cfm5";BRnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;=20
}/FONT/DIV
DIVFONT face=3DArial size=3D2}/FONT/DIV/B