Simple enough to be overlooked... Thank you! Just what I needed. Everything
works just fine now :)
Lynn
Le lundi 8 avril 2013 23:25:15 UTC+2, asgallant a écrit :
>
> There is a simpler way to handle this: use the Query#setQuery method to
> construct the select statement. This avoids any conversion problems.
>
> var query = new google.visualization.Query("
> https://spreadsheets.google.com/a/
> "+domain+"/tq?key="+key+"&headers=1&range="+range+"&sheet="+sheet);
> query.setQuery('select * where lower(' + searchColumn + ') contains "' +
> filter.toLowerCase() + '"');
>
> On Monday, April 8, 2013 3:09:30 PM UTC-4, Lynn wrote:
>>
>> Hello,
>>
>> I am having a hard time getting the right way to escape quotes AND double
>> quotes at the same when using the google.visualization.Query and the
>> where clause.
>>
>> I keep on getting the error :
>>
>> Error in query: Invalid query Query parse error: Encountered "
>>>> <UNEXPECTED_CHAR> "\' "" at line 1, column 42.
>>>
>>> Was expecting one of:
>>>
>>> "," ...
>>>
>>> ")" ...
>>>
>>> "*" ...
>>>
>>> "+" ...
>>>
>>> "-" ...
>>>
>>> "/" ...
>>>
>>> "%" ...
>>>
>>> "*" ...
>>>
>>> "/" ...
>>>
>>> "%" ...
>>>
>>> "+" ...
>>>
>>> "-" ...
>>>
>>> "," ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> ")" ...
>>>
>>> "*" ...
>>>
>>> "/" ...
>>>
>>> "%" ...
>>>
>>> "+" ...
>>>
>>> "-" ...
>>>
>>>
>> This is how the call is made for the moment and the problem comes from
>> the filter parameter which can contain quotes and/or double quotes :
>>
>> filter = encodeURIComponent(filter);
>>
>> filter = encodeURI(filter);
>>>
>> new google.visualization.Query("https://spreadsheets.google.com/a/
>>> "+domain+"/tq?key="+key+"&headers=1&range="+range+"&sheet="+sheet+"&tq=select%20*%20where%20lower("+searchColumn+")%20contains%20lower('"+filter+"')");
>>
>>
>> or without the lower function on filter :
>>
>>
>>> filter = encodeURIComponent(filter);
>>
>> filter = encodeURI(filter);
>>
>> filter.toLowerCase();
>>
>> new google.visualization.Query("https://spreadsheets.google.com/a/
>>> "+domain+"/tq?key="+key+"&headers=1&range="+range+"&sheet="+sheet+"&tq=select%20*%20where%20lower("+searchColumn+")%20contains%20'"+filter+"'");
>>
>>
>> I've been trying to figure out the right way to either
>> use encodeURIComponent/encodeURI for example. The question seems so simple
>> that I feel like I am missing something quite obvious.
>>
>> Thank you in advance for any help.
>>
>> Lynn
>>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.