2 Replies Latest reply on Mar 9, 2015 5:25 AM by Stu412

    ExecuteSQL with variable



      ExecuteSQL with variable


      Hi there

      I've created a filtered portal using radio buttons sat on a Global Field.  Click a button, the portal filters.  

      What I want to do is calculate the average of the filtered results using an SQL command.  I've managed this with a fixed WHERE clause, but not when using the variable which filters the portal.

      ExecuteSQL ("Select AVG(Value) where type = 'Admin'";"";"") will work fine.

      I need to change 'Admin' to a dynamic variable, but when I try the folowing, I get the '?' response:

      ExecuteeSQL ("Select AVG(Value) where type = $$GF_Type;"";"")

      ExecuteSQL ("Select AVG(Value) where type = Global::GF_Type;"";"") also fails.

      Forgive any syntax errors, I hope you get the idea.

      Bascially, how do I make the SQL dynamic based on user input?