OR just use the list nature of CFCASE:

<cfcase value="-1">
string 1 is neither equal nor greater
</cfcase>
<cfcase value="0,1">
string 1 is equal or greater
</cfcase>

----------------------------------------

From: "Michael Grant" <mgr...@modus.bz>
Sent: Tuesday, January 11, 2011 2:59 PM
To: "cf-talk" <cf-talk@houseoffusion.com>
Subject: Re: compare using cfcase

Try setting a var and then using _that_ in your cfcase.

<cfset isLTE = false />
<cfif string1 LTE string2>

<cfset isLTE = true />

</cfif>

<cfswitch expression = #isLTE#>
<cfcase value = "true">
<h3>String 1 is less than or equal to String 2</h3>
<I>The strings are not equal</I>
</cfcase>
<cfcase value = "false">
<h3>String 1 is gt than String 2</h3>
</cfcase>
<cfdefaultcase>
<h3>This is the default case</h3>
</cfdefaultcase>
</cfswitch>
</cfif>

On Tue, Jan 11, 2011 at 2:44 PM, Orlini, Robert 
<rorl...@hwwilson.com>wrote:

>
> OK, but I have not done that in the code below. I just want to do a less
>  than or equal comparison. Can that be done using CFCASE?
>
> Can it be <cfcase value="1"> or <cfcase value="0">
>
> RO
>
> -----Original Message-----
> From: "Russ Michaels" <r...@michaels.me.uk>
> Sent: Tuesday, January 11, 2011 2:38pm
> To: "cf-talk" <cf-talk@houseoffusion.com>
> Subject: RE: compare using cfcase
>
>
> If you have
>
> <cfcase value="0,1">
>
> And
> <cfcase value="1">
>
> Then you are duplicating the condition as you have 1 in both cfcases.
>
> The value must only appear once.
>
> Russ
>
> -----Original Message-----
> From: Orlini, Robert [mailto:rorl...@hwwilson.com]
> Sent: 11 January 2011 19:29
> To: cf-talk
> Subject: RE: compare using cfcase
>
>
> No Russ,
>
> Here is the full code below. I would like one of the fields to test for 
eq
> to or gt:
>
> <cfif IsDefined("FORM.string1")>
>  <cfset comparison = Compare(FORM.string1, FORM.string2)>
>  <!--- Switch on the variable to give various responses. --->  <cfswitch
> expression = #comparison#>
>    <cfcase value = "-1">
>        <h3>String 1 is less than String 2</h3>
>        <I>The strings are not equal</I>
>    </cfcase>
>    <cfcase value = "0">
>        <h3>String 1 is equal to or gt than String 2</h3>
>        <I>The strings are equal!</I>
>    </cfcase>
>    <cfcase value = "1">
>        <h3>String 1 is greater than String 2</h3>
>        <I>The strings are not equal</I>
>    </cfcase>
>    <cfdefaultcase>
>        <h3>This is the default case</h3>
>    </cfdefaultcase>
>    </cfswitch>
> </cfif>
>
> RO
>
> -----Original Message-----
> From: "Russ Michaels" <r...@michaels.me.uk>
> Sent: Tuesday, January 11, 2011 2:22pm
> To: "cf-talk" <cf-talk@houseoffusion.com>
> Subject: RE: compare using cfcase
>
>
> Have you got multiple CFCASES with the same value ?
>
>
> -----Original Message-----
> From: Orlini, Robert [mailto:rorl...@hwwilson.com]
> Sent: 11 January 2011 19:19
> To: cf-talk
> Subject: Re: compare using cfcase
>
>
> Thanks Russ,
>
> That gives me an error (below) when I tried <cfcase value = "0,1"> to 
check
> whether String 1 is equal to or greater than String 2
>
> "Context validation error for tag CFCASE.
> The CFSWITCH has a duplicate CFCASE for value "1.0".
> ColdFusion cannot determine the line of the template that caused this
> error.
> This is often caused by an error in the exception handling subsystem. "
>
> RO
>
> -----Original Message-----
> From: "Russ Michaels" <r...@michaels.me.uk>
> Sent: Tuesday, January 11, 2011 2:13pm
> To: "cf-talk" <cf-talk@houseoffusion.com>
> Subject: Re: compare using cfcase
>
>
> you mean CFCASE not CFACASE :-)
>
> to condition multiple values use a list
>
> <cfcase value="1,2,3">
>
>
> Russ Michaels
>
> www.bluethunderinternet.com  : Business hosting services & solutions
> www.cfmldeveloper.com        : ColdFusion developer community
> www.michaels.me.uk           : my blog
> www.cfsearch.com             : ColdFusion search engine
> **
> *skype me*                     : russmichaels
>
>
>
>
>
>
>
>
>
>
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340636
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to