Query Syntax for referencing variables outside of the query

19 views
Skip to first unread message

jscam

unread,
Feb 12, 2012, 8:25:44 PM2/12/12
to Google Visualization API
Can anyone help in explaining how to properly use outside variables
from within the Google API query - example:

query.setQuery('SELECT D,sum(E) WHERE Year(A) = 2011 group by D');

instead of using 2011 as a year, i have a variable var reportingYear
declared as a global variable that is manipulated in a method as a
dropdown menu changes its value with user interaction.

I am at a loss how to incorporate this into the query as the variable
changes.

query.setQuery('SELECT D,sum(E) WHERE Year(A) = `reportingYear` group
by D');

Any help appreciated - thanks

asgallant

unread,
Feb 13, 2012, 9:53:50 AM2/13/12
to google-visua...@googlegroups.com
query.setQuery('SELECT D,sum(E) WHERE Year(A) = ' + reportingYear + ' group by D');  

jscam

unread,
Feb 13, 2012, 4:17:12 PM2/13/12
to Google Visualization API
thanks
Reply all
Reply to author
Forward
0 new messages