SQL (Structured Query Language)
is the language used to access fusiontables. SQL is a syntax oriented language.
The SQL statements have to follow exactly the defined syntax else this results in errors.
The syntax is defined in the Fusiontable Row and Query SQL Reference.
What is an SQL statement? An SQL statement is a string of characters that conforms to the defined format and syntax rules. An SQL statement can be sent to a database for example to select, insert, update or delete records.
Example of an SQL statement:
INSERT INTO 1FRIkIxJ3nqhR23XY2EYorU7vC63Zahgjz1KaDTc (Date, Name, Pizza, Drink, Comment) VALUES('26.04.2014 07:58:07', 'Taifun', 'Pepperoni', 'Sprite', 'none')
App Inventor offers the "Do it" functionality to debug your code (see also the screenshot above).
Right click onto the join block of your SQL statement and select "Do it" from the context menu.
The "Do it" result will be displayed in a comment window. Then resize the comment window to see the complete "Do it" result.
Also don't hesitate to take a look at the Fusiontable Row and Query SQL Reference.
Normally the error message should give you a good hint, what is wrong.
The error messages sometimes might be a little bit hard to understand...
For Jack, this was the solution: in the blocks editor, my service account email was copied with spaces at the end which seems to caused the issue.
Going through and re-copy-pasting the service account into the blocks editor, design editor, and the share link from the fusion table
ultimatly allowed me to edit the fusion table from the app.
The correct quotify procedure looks like this
Can you see what the error message is trying to tell you?
Here is the SQL statement from the "Do it" result window:
INSERT INTO1FRIkIxJ3nqhR23XY2EYorU7vC63Zahgjz1KaDTc(Date, Name, Pizza, Drink, Comment) VALUES('26.04.2014 09:32:51', 'Taifun', 'Pepperoni', 'Sprite', 'none')
There are a lot of different "400 Bad Request" errors possible. For example the mentioned Parse error near ... error. Important in this case is: near what?... Therefore: read the error message completely to find out what is going on...
MIT is aware of that issue, see also here. Meanwhile you can use the service account method instead
How to use the Service account option to connect to a Fusiontable
There are 3 steps for sending queries to a fusiontable
You set up the API key in the API Console using your Google account. Now you are trying to access the table with another account. Grant access to the table for the other account or use your first Google account instead.
Just use the SendQuery block...
If you checked for all the Frequent Made Errors and the error message doesn't tell you anything to fix this, open a new thread in the MIT App Inventor forum and add a screenshot of your SQL statement including the "Do it" result and a screenshot of your error message and I will try to help you. Thank you.
You probably might be interested in my App Inventor - Fusiontable interface,
which uses the web component instead of the fusiontable controls. That solution offers some advantages...
Back to top of page ...
This work by Pura Vida Apps is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.