App Inventor and Fusiontables


How to delete one or more rows from a Fusion Tables Fusiontable

Note: Google changed the DELETE logic and you do not need the ROWIDs anymore to delete rows, just use your WHERE condition instead.

Preconditions

  1. You already have done the Pizza Party tutorial and you already created a fusiontable, which means, you already have a table id, service account email address and p12 file.
  2. You already inserted some orders successfully in the table using the Pizza Party tutorial
  3. You are familiar with the Top 5 Tips: How to learn App Inventor

How does the DELETE generally work for fusiontables?

See the the SQL Reference Documentation of the Fusion Tables API.

For DELETE statements the first step to be done is to get the ROWID of the row to be deleted with a SELECT statement. The second step is to do the DELETE.

How to use the example project

  1. Download the example project from the download section below and upload it into App Inventor
  2. Upload your keyfile into the project
  3. In the designer assign the uploaded keyfile to the keyfile property of the fusiontable control component
  4. In the blocks editor add your tableid and service account email address

App Inventor Blocks





Step 1 (to get the list of rowids to be deleted) will be executed only once and Step 2 (to delete a row) will be executed several times as much as rowids are in the list.

Debug Recommendations

To find out, if the first SQL statement is correct, after entring a name in the textbox, right click onto the join block of the sql statement and select Do it.


Forgetting spaces is a frequently made error, see also Frequently Made Errors with Fusion Tables Fusiontables and how to fix them

To find out, if the second SQL statement is correct, disable the SendQuery block in Step 2, then click onto the "Delete my order" button and after the select statement has been executed and a rowid has been found in the table, then right click onto the join block of the sql statement and select Do it like this:


Screenshots

Questions and Answers

Q1: Actually under the ID in some row, I have the same ID. So actually if I delete, I want to delete the multiple row that have the same ID. Am I able to do that?
A: See ABG's answer here: You keep a list of the rowIDs you want to delete, and send away one request for the first DELETE. After you get the receipt that it was deleted, take it off your list and send off the new one at the head of the list. Stop when the list is empty. See the updated example how to do it. An other example of the same method you can find in my filebyfile example.

For questions about App Inventor,
please ask in the App Inventor community.Thank you.

Download

Download fusiondelete aia file
Back to top of page ...

Creative Commons License
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.


Home | Snippets | Tutorials | Extensions | Links | Search | Privacy Policy | Contact