2014년 12월 30일 화요일

Help with simple Pizza Party query please


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. 

--
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 dispaly 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

--
here is an example of a modified URL https://fusiontables.googleusercontent.com/fusiontables/embedviz?viz=GVIZ&t=TABLE&q=select+*+from+1Ty90w_LWJEgZHNwEWgoebigLDEXPYLAgJHVHSFkk+WHERE+Pizza+%3D%27Cheese%27&containerId=googft-gviz-canvas

--
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.



--
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 th URI encode block of th web component or you cn do it manually
just use your table id instead of mine, that's all...

--
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. 

--
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

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

--
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.

--
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...
--
OK thank you. Here is the latest screen shot, I hope it helps. I've tried many different combinations.Thanks!

--
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


--
Thank you for all your help. This is exactly what I was looking for.

--
Thanks Taifun, I was able to modify the webviewer url and it gave me exactly what I wanted.

--

댓글 없음:

댓글 쓰기