-2

I'm trying to get some rows from a table using the GetRowsWithConditions method in App Inventor 2. I've used AND and it works correctly but when I use OR I get
400 Bad Request Invalid query: Parse error near 'OR'.

The condition is

WHERE ROWID=1 OR ROWID=1001 OR ROWID=2001
Taifun
  • 6,165
  • 17
  • 60
  • 188

2 Answers2

1

OR does not exist in the Fusiontable SQL language,
see also the SQL Reference Documentation of the Fusion Tables API.

Taifun
  • 6,165
  • 17
  • 60
  • 188
1

As Taifun mentioned, "OR" is not supported in Fusion Tables, but an alternative suggested by Google is to use "IN".

Wikipedia Entry:

IN will find any values existing in a set of candidates.

SELECT ename WHERE ename IN ('value1', 'value2', ...)

All rows match the predicate if their value is one of the candidate set of values. This is the same behavior as

SELECT ename WHERE ename='value1' OR ename='value2'

except that the latter could allow comparison of several columns, which each IN clause does not. For a larger number of candidates, IN is less verbose.


So in theory*, your query would be reformatted to:

... WHERE ROWID IN ('1','1001','2001')

Hope that helps!

*I say in theory, because I've never used ROWID as the filter as I've always created a custom ID column.

TimesWasting
  • 70
  • 1
  • 7
  • this is correct and does not only work in theory, but also in practice, which means, your answer was not a waste of time ;-) and should also be the accepted answer... however unfortunately that guy who asked that question never came back to see the answers... – Taifun May 27 '16 at 23:55
  • Sorry about that. I'm doing this in my free time and it's not to much. I'll try it as soon as possible. I had changed my mind and now I have to recode this part of the app in order to do like this, it's much better.. – raul insagurbe May 30 '16 at 14:38
  • hi again, I've tried it with SELECT and it works properly. Now I would like to do the same with DELETE but I have an error. Thaks to the link Taifun (sorry for being late again) linked I understand that it should work the same way but it seems that it doesn't. – raul insagurbe May 30 '16 at 21:30
  • for new questions you should [ask a new question](https://stackoverflow.com/questions/ask), see also [How to ask a good question](http://stackoverflow.com/help/how-to-ask) ... [How to delete one or more rows from a Fusiontable](https://puravidaapps.com/fusiondelete.php) – Taifun May 31 '16 at 01:32
  • If I've understand correctly you say in the last question of the explanation that this can be done deleting the rows one by one. That's the way I'm doing but it's not very useful when I have to delete, let's say, 50 rows. I was thinking of deleting all the table but I have the same problem when I insert one by one the rows I want to keep. Thanks a lot, I'll ask a new question but perhaps there is no way.. – raul insagurbe May 31 '16 at 21:00