This might work as well (and get rid of evaluate for you)

<cfif variables[a] eq variables[b]>


.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
http://cf4em.com


-----Original Message-----
From: Richard White [mailto:[email protected]] 
Sent: Thursday, July 07, 2011 9:29 AM
To: cf-talk
Subject: Re: dynamic if statements


apologies, the evaluate works fine, there was a mistake in my code :) 

i was unnecessarily wrapping the variables with hashes: <cfif evaluate("#a#
eq #b#")></cfif>



> Hi,
> 
> i have an if statement that checks multiple values such as:
> 
> <cfif (a eq 1) and (b eq 2) and (c eq 3)>
> </cfif>
> 
> however i need it to be dynamic, for example sometimes it may:
> 
> <cfif (a eq 1)>
> <cfif (a eq 1) and (b eq 2) and (c eq 3) >
> <cfif (a eq 1) and (b eq 2) and (c eq 3) and (d eq 4) >
> 
> i have tried creating a string and then using the evaluate function 
> which works fine until one of the values has a double or single quote, 
> e.g
> 
> <cfset a = '"' />
> <cfset b = "-" />
> <cfif evaluate("a eq b")></cfif>
> 
... 
> it then throws an error due to the double quote being encapsulated 
> within the double quotes of the evaluation function.
> 
> would appreciate some help on the best way to achieve this
> 
> thanks 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:346142
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to