Page 1 of 2

Problem with Google Query Lannguage

Posted: Tue Sep 30, 2014 4:43 pm
by teacherguy
Hello all,

I have been having trouble with the new versions of google's spreadsheets. Oddly, I have been able to solve this on my iPad app, but my desktop version does not work (using the same code).

So for example, here is code that works on the iPad and it also will work in your browser (just cope and paste this into a new window)

https://docs.google.com/spreadsheets/d/ ... &tq=select*

When I try the format above in my script on my desktop app, it fails:

Code: Select all

get URL "https://docs.google.com/spreadsheets/d/13BWTR_-1VrqJ3H-QPPr0YP5wyG8305OjLVwje1OJgW4/gviz/tq?tqx=out:json&tq=select*"
Any ideas?

Re: Problem with Google Query Lannguage

Posted: Tue Sep 30, 2014 5:47 pm
by Klaus
Hi,

hm, works fine here, LC 6.6.3, Mac Mini!?

Here the data:
google.visualization.Query.setResponse({"version":"0.6","reqId":"0","status":"ok","sig":"192650728","table":{"cols":[{"id":"A","label":"Timestamp","type":"datetime","pattern":"M/d/yyyy H:mm:ss"},{"id":"B","label":"Name","type":"string"},{"id":"C","label":"Instrument","type":"string"},{"id":"D","label":"Session Time","type":"string"},{"id":"E","label":"Highest Level Passed","type":"number","pattern":"General"},{"id":"F","label":"Score","type":"number","pattern":"General"},{"id":"G","label":"Teacher","type":"string"},{"id":"H","label":"Course","type":"string"},{"id":"I","label":"Percentage","type":"number","pattern":"0%"}],"rows":[{"c":[{"v":new Date(2014,8,30,10,18,34),"f":"9/30/2014 10:18:35"},{"v":"Brian Wis"},{"v":"Trumpet"},{"v":"3 minutes"},{"v":6.0,"f":"6"},{"v":400.0,"f":"400"},{"v":"Ms. Corry"},{"v":"6th Grade Band"},{"v":0.9,"f":"90%"}]}]}});

You should check "the result" immediatly after GETting the url!
It is EMPTY on success, like here in my test.


Best

Klaus

Re: Problem with Google Query Lannguage

Posted: Tue Sep 30, 2014 8:09 pm
by teacherguy
My result: socket timeout spreadsheets.google.com:443|6930

Re: Problem with Google Query Lannguage

Posted: Tue Sep 30, 2014 8:37 pm
by Klaus
AHA! So in general it works :D

Re: Problem with Google Query Lannguage

Posted: Tue Sep 30, 2014 8:38 pm
by teacherguy
Klaus wrote:AHA! So in general it works :D
Haha, well yes I suppose so!

I tried adding:

Code: Select all

set the sockettimeoutinterval to 5000
And now the result is empty....but so is "it"

:-(

Re: Problem with Google Query Lannguage

Posted: Tue Sep 30, 2014 10:51 pm
by Simon
Hi teacherguy,
Don't forget that the iPad is probably being directed to a mobile site, your desktop might not like that.

Simon

Re: Problem with Google Query Lannguage

Posted: Wed Oct 01, 2014 12:01 am
by teacherguy
Hi Simon, I don't think I understand what you mean?

I've built the apps separately, but in trying to use the same code in both stack scripts it does not react the same way. I don't think there is anything "mobile" about what I have listed above but again I probably just don't understand what you mean.

Re: Problem with Google Query Lannguage

Posted: Wed Oct 01, 2014 12:07 am
by teacherguy
Another piece of the puzzle.

Upon arriving home (where I use a different computer) I opened the stack and *it works.*

But then, I compile standalones for Mac and Windows... and it does not work.

So now I'm thinking that something is not being included when compiling? I have not worked on this software in a year or more, has anything changed in regards to using a launcher stack (which is what I'm doing)?

Re: Problem with Google Query Lannguage

Posted: Wed Oct 01, 2014 12:13 am
by Simon
Hi teacherguy,
I don't think that it is actually the problem.
But what I meant was, sites have auto redirects, when the see a mobile device is asking for data they get directed to the mobile version of the page. It's in the header of the request, you never see it unless you are looking at the sever logs.

Chrome on Win 7 returned this:
google.visualization.Query.setResponse({"version":"0.6","reqId":"0","status":"ok","sig":"192650728","table":{"cols":[{"id":"A","label":"Timestamp","type":"datetime","pattern":"M/d/yyyy H:mm:ss"},{"id":"B","label":"Name","type":"string"},{"id":"C","label":"Instrument","type":"string"},{"id":"D","label":"Session Time","type":"string"},{"id":"E","label":"Highest Level Passed","type":"number","pattern":"General"},{"id":"F","label":"Score","type":"number","pattern":"General"},{"id":"G","label":"Teacher","type":"string"},{"id":"H","label":"Course","type":"string"},{"id":"I","label":"Percentage","type":"number","pattern":"0%"}],"rows":[{"c":[{"v":new Date(2014,8,30,10,18,34),"f":"9/30/2014 10:18:35"},{"v":"Brian Wis"},{"v":"Trumpet"},{"v":"3 minutes"},{"v":6.0,"f":"6"},{"v":400.0,"f":"400"},{"v":"Ms. Corry"},{"v":"6th Grade Band"},{"v":0.9,"f":"90%"}]}]}});

Simon

Re: Problem with Google Query Lannguage

Posted: Wed Oct 01, 2014 12:30 am
by teacherguy
Simon,

Yes I see exactly what you listed above if I try any browser. When that json is retrieved it gets parsed and life is good.

But for some reason it is not working properly in certain situations and I'm not sure why that is. At the moment is works ok in development at home, however when I build the standalone it does not.

Re: Problem with Google Query Lannguage

Posted: Wed Oct 01, 2014 12:49 am
by Simon
Have you got all the "required inclusions" set (internet)? In the standalone General tab.

Simon

Re: Problem with Google Query Lannguage

Posted: Wed Oct 01, 2014 1:00 am
by teacherguy
Yes, in fact I even tried selecting everything available just in case, but no change.

And since I also have issues at work *even without compiling* it makes me think something else is afoot.

Using 6.6.3

Re: Problem with Google Query Lannguage

Posted: Wed Oct 01, 2014 2:50 am
by teacherguy
Think I tracked it down.

Note to self: Leaving a "mobilebusyindicatorstart" in your desktop script may not yield an error when developing, but can halt a script in a (desktop) standalone.

Re: Problem with Google Query Lannguage

Posted: Wed Oct 01, 2014 4:35 pm
by teacherguy
So by the end of the night at home, I had everything working perfectly on a standalone, which synced to Dropbox.

Got to school this morning, ran the standalone....no good.

So I'm now suspecting my tech people have put some sort of filter in place with google docs?

And yet I can still perform the query in a browser. Does the app use a different port than 80? How would I check this?

Re: Problem with Google Query Lannguage

Posted: Wed Oct 01, 2014 7:48 pm
by teacherguy
Here is a script where (at work) I get:

result: empty
it: OK

Since this seems to somehow be related to something going on in my school building, I imagine that if any of you try this you will get a proper json "it" as I do at home. But if anyone has ideas as to why I would get the word "OK" at work (instead of the json) I'd love to hear it.

Code: Select all

on mouseUp
   put "https://docs.google.com/spreadsheets/d/" into downloadFirstHalf
   put "1kzVH1Nv9K3tuZCTyIs6BPbGT-wycs8aIRlhLdz5ZCpk" into downloadKey
   put "/gviz/tq?tqx=out:json&tq=select+A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS+order+by+A+desc" into downloadSecondHalf
   put downloadFirstHalf&downloadKey&downloadSecondHalf into wholeURL
   libURLSetSSLVerification false 
   get URL wholeURL
   set the sockettimeoutinterval to 1000
   answer the result
   put it 
end mouseUp