Table.filter Problem

alea46

Member
Licensed User
Hi,
I can't do a table.filter!

I try to filter table with number.
I got syntax error or error in executing program.

My program is attach.



:sign0085:
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
tablelat.Filter("(lat>(latact+larg) OR lat>(latact-larg)) AND (lon >(lonact+larg) OR lon <(lonact-larg))")

Basic4ppc doesn't replace latact and larg in the string with the values stored in these variables.
For example:
B4X:
a = 5
msgbox("The value is a") 'Prints: The value is a.
msgbox("The value is " & a) 'Prints: The value is 5.
So in your case you have two options.
B4X:
tablelat.Filter("(lat>(" & latact & "+" & larg & ") OR lat >(" & ...
Or:
B4X:
filter = "(lat>(latact+larg) OR lat>(latact-larg)) AND (lon >(lonact+larg) OR lon <(lonact-larg))"
filter = StrReplace(filter, "latact", latact)
filter = strReplace(filter, "larg", larg)
tableat.Filter(filter)
 

alea46

Member
Licensed User
Thanks Erel.

I still have problems of comprehension of the syntax of Basic4PPC.
Sometimes, I do not succeed in finding example on the forum or in help to fill up my lack.

One question into the forum, and it's good.
 
Top