Jason, That is what I have already suggested, but for some reason it is throwing an error. It is definitely valid syntax for a CFCASE statement.
Which version of CF are you using. can you show us the exact error and section of code it relates to, On Tue, Jan 11, 2011 at 8:22 PM, Jason Fisher <[email protected]> wrote: > > 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" <[email protected]> > Sent: Tuesday, January 11, 2011 2:59 PM > To: "cf-talk" <[email protected]> > 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 > <[email protected]>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" <[email protected]> > > Sent: Tuesday, January 11, 2011 2:38pm > > To: "cf-talk" <[email protected]> > > 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:[email protected]] > > 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" <[email protected]> > > Sent: Tuesday, January 11, 2011 2:22pm > > To: "cf-talk" <[email protected]> > > Subject: RE: compare using cfcase > > > > > > Have you got multiple CFCASES with the same value ? > > > > > > -----Original Message----- > > From: Orlini, Robert [mailto:[email protected]] > > 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" <[email protected]> > > Sent: Tuesday, January 11, 2011 2:13pm > > To: "cf-talk" <[email protected]> > > 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:340640 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

