3 Replies Latest reply on Feb 20, 2010 7:51 PM by kenji776

    Entirly dynamic IF conditions

    kenji776 Level 1

      Hey All,

      I am doing something a little strange. Basically I have a database table with some coldfusion If statments. Things like

      "age GT 18" or

      "name eq 'frank'"

      etc. Basically it's a dynamic rule engine. Allows my users to place triggers in an app. Question is, how do I evalulate those conditions. I pull them from the database, loop over the query, but I can't actually get CF to parse the contructed IF statment. For example...


      <cfset YearsOld = 67>
      <cfquery name="GetConditions" datasource="webserver">
           Select * 
           From SignUpFormAdditionalActions
           Where Active = 1
           <cfloop query="GetConditions">
                <cfif GetConditions.Condition>
                     Met #GetConditions.Name#. #GetConditions.Content#<br />


      And here is what my database looks like


      I know this should be easy, I'm just kinda having a brain fart. Thanks!