AnsweredAssumed Answered

Problem with ExecuteSQL

Question asked by andretru2 on Nov 11, 2014
Latest reply on Nov 13, 2014 by philmodjunk


Problem with ExecuteSQL



Sorry if this has been posted before but I was unable to find a similar issue (been looking for 2 hours).

Anyways, hope this is rather an easy solution. 

I have a text field ("sqlQuery") with a sql statement (below) and a "run" button:

"select nameFirst 
from People 
where cast(id_status as varchar(25)) in ( select Parameter     
                                                          from ReportParameters  
                                                           where fieldParameter='id_status'  
                                                           and id_report=1) "

The script ideally would execute this sql referencing the field such as:

$set Variable [$sql; Value: ExecuteSQL(ReportSetup::sqlQuery;"";"")

However, it returns a "?".

The funny thing is that if I replace the ReportSetup::sqlQuery with the actual query, it works. 

I've tried all kinds of things trying to mimic the quotation marks but no success (i.e. "Quote")

Hopefully this is doable as I'm building a dynamic report builder and I want to execute whatever SQL statement is stored in the ReportSetup table.

Thanks in advance,