> -----Original Message-----
> From: Brook Davies [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 15, 2001 3:06 PM
> To: CF-Talk
> Subject: Executing Dynamic Code
> 
> 
> 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?

You CAN evaluate expressions after grabbing them from a database or setting them equal 
to a variable:

<cfset a = 5>
<cfset x = "a GTE 1">

<cfoutput>
        <cfif Evaluate(x)>
                #a#
        <cfelse>
                a is less than 1
        </cfif>
</cfoutput>

However, you won't be able to execute cf tags in this way.  The only way to do that, 
so far and as far as I KNOW, is the file based writing/including method you mentioned.



-Andy


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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