Help with simple Pizza Party query please

843 views
Skip to first unread message

Burt Lewis

unread,
Dec 28, 2014, 4:40:51 PM12/28/14
to mitappinv...@googlegroups.com
Hi,

I completed the Pizza Party sample without any problems and now I wanted to try to query the fusion table by searching for specific items. In this case after I press the Submit button,  I want to see in the webviewer, all items in the Pizza column that have Cheese. When  I run this app from my phone, I get the entire table, not just the rows with Cheese. I know I'm doing something wrong but after quite a bit of time looking for examples and trying things myself, I'm stuck. Appreciate any help or ideas. Thank you.
querysample1.jpg

Taifun

unread,
Dec 28, 2014, 4:53:24 PM12/28/14
to
1. do not use the DoQuery block, because that block is deprecated
2. you will get the result of your query in the FusiontablesControl.Got result event, to display the result, you could use this example
alternatively if you like to display the result in the webviewer directly, you have to modify the URL of the webviewer accordingly
Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

Taifun

unread,
Dec 28, 2014, 5:07:19 PM12/28/14
to

Burt Lewis

unread,
Dec 28, 2014, 7:17:23 PM12/28/14
to mitappinv...@googlegroups.com
Taifun,

Thank you for your help but my attempt at modifying the code to the example you pointed me to resulted in nothing being displayed in the webviewer. I also don't understand how I apply your example of the modified URl code to my code example. Thank you.


ScreenHunter_17 Dec. 28 19.04.jpg

Taifun

unread,
Dec 28, 2014, 8:24:31 PM12/28/14
to
if you take a closer look at the URL, you will find,out, that there are 3 parts
1. it starts with https://fusiontables.googleusercontent.com/fusiontables/embedviz?viz=GVIZ&t=TABLE&q=
2. followed by an URI encoded select statement, which is in my case select+*+from+1Ty90w_LWJEgZHNwEWgoebigLDEXPYLAgJHVHSFkk+WHERE+Pizza+%3D%27Cheese%27
which is nothing else than the URI encoded select statement you are looking for SELECT * FROM <tableid> WHERE Pizza = 'Cheese'
for the URI encoding you can use the URI encode block of the web component or you can do it manually
just use your table id instead of mine, that's all...
Taifun

Burt Lewis

unread,
Dec 28, 2014, 9:18:07 PM12/28/14
to mitappinv...@googlegroups.com
I thank you again and understand that is the end result url but it doesn't help me modify my block code that I included to indicate why it is not working when I run it on my phone. Are there any other visual code example you can point me to? I have yet to find one example that does a simple search and returns a result to the phone screen. Thank you!

Taifun

unread,
Dec 29, 2014, 11:28:47 AM12/29/14
to mitappinv...@googlegroups.com
if you don't understand what I was saying, let me recommend you to first do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the
 Top 5 Tips: How to learn  App Inventor


also probably it's easier for you to follow the first option using the fuisiontable ocntrols, see also How to INSERT, DELETE and SELECT a Fusiontable by Viktor

Burt Lewis

unread,
Dec 29, 2014, 11:55:58 AM12/29/14
to mitappinv...@googlegroups.com
I understand exactly what you are saying but I am not looking for a URL, I am looking for help specific to the code images I included in my posts to understand why it's not working and what I have done wrong. It's like me asking you how to fish and you hand me a fish, that's not what I want. I've gone through every tutorial, I guess I'll have to keep plugging away it. Thanks.

Taifun

unread,
Dec 29, 2014, 12:34:03 PM12/29/14
to mitappinv...@googlegroups.com
then you should prepare a new screenshot and add all information I gave you...
I can't see the complete URL in the webviewer.HomeUrl in your screenshot, I only can see the SELECT statement in your variable pizzatable...
Taifun


Burt Lewis

unread,
Dec 29, 2014, 1:04:14 PM12/29/14
to mitappinv...@googlegroups.com
OK thank you. Here is the latest screen shot, I hope it helps. I've tried many different combinations.Thanks!


ScreenHunter_18 Dec. 29 12.45.jpg

Taifun

unread,
Dec 29, 2014, 2:58:37 PM12/29/14
to
you are mixing 2 different solutions
1. the fusiontable controls solution according to this example How to INSERT, DELETE and SELECT a Fusiontable by  Viktor and
2. the webviewer URL solution

"here is your fish" for the webviewer URL solution, just add your table id instead
Taifun


burt.aia

Burt Lewis

unread,
Dec 29, 2014, 9:37:17 PM12/29/14
to mitappinv...@googlegroups.com
Thank you for all your help. This is exactly what I was looking for.

Emeka Ezeanya

unread,
Mar 25, 2015, 12:59:57 PM3/25/15
to mitappinv...@googlegroups.com
Thanks Taifun, I was able to modify the webviewer url and it gave me exactly what I wanted. Thanks!!!!
Reply all
Reply to author
Forward
0 new messages