On 8/15/01, Brook Davies penned:
>Hello World,
>
>I have a template which allows a user to build a criteria based selection.
>Somthing like where x=10 and/or z gte 100. After the user has created the
>expression it is stored in a database, then I need to pull it out and try
>to execute it within a cfif block.
>
>So I need to build a string like <cfif #thereVariable# #operator# #value#>
>and then actually execute this code. I Know I can do this if I write it to
>a file and then include the file the code will get executed. But is there
>any other way to do this other than writing to a file?
>
>Thanks for the help, btw I'm using 4.5.1....

Sure.

<cfset myexpression = "x = 10 and (z gte 5 or z lt 2)">

<cfset x = 10>
<cfset z = 6>

<cfif evaluate(myexpression)>
Yes
<cfelse>
No
</cfif>

Of course, I presume myexpression will be a query result.
-- 

Bud Schneehagen - Tropical Web Creations

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to