How to get RowID from google fusion table

大憨熊 提交于 2019-12-12 03:54:38

问题


I have been using Google Fusion Tables with App Inventor, so there isn't much info out there other than that Pizza Party Tutorial. I've been looking at SQL solutions and such for the formatting of queries, but I just can't seem to get it right it appears. I am attempting to use the following code:

in order to find the rowid of a row in my fusion table. However, whenever I send the query, I get the following error: Attempt to get item number 2 of a list of length 1: (51) 51 is the number I want, yet for some reason it is accessing the index 2 and I am not sure why.

This is the code that runs when I receive a result, but I never get a result because the query is apparently accessing index 2 or something. I tried to change the last line to say index 2, but I still got the same error - there's still an error for saying index 1...


回答1:


The FusiontableControl component works asynchronously, which means, you send the query and in the FusiontableControl.GotResult event you receive the result. Therefore the blocks after your SendQuery method do not make much sense...

In the FusiontableControl.GotResult event your result will look like this

rowid
51

Inside that event use the split block to split the result at \n (new line) to get a list and select the 2nd item from the list using the select list item block to get the value 51. You also can add some error handling and check, if the length of the list is > 1 before selecting the 2nd item...



来源:https://stackoverflow.com/questions/40776353/how-to-get-rowid-from-google-fusion-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!