AnsweredAssumed Answered

ExecuteSQL with variable

Question asked by Stu412 on Mar 9, 2015
Latest reply on Mar 9, 2015 by Stu412

Title

ExecuteSQL with variable

Post

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?

 

Thanks

 

Outcomes