Another table filter question

Ariel_Z

Active Member
Licensed User
Suppose the textbox is called TextBox1, then you can try:

B4X:
table1.filter = "[col_name] = " & TextBox1.Text

Let me know if this helps you. Note that [col_name] is the name of the relevant column, which you want to filter.
 

michaelm

Member
Licensed User
Longtime User
It's not working. I get a syntax error that says: 'Missing operand after '=' operator' Do you have any other ideas?:confused:
 

michaelm

Member
Licensed User
Longtime User
I've played around with it and it seems to work when I enter the name of the column in the textbox, of course it returns all rows in the column. I need to filter for only certain entries within the column that meet the search criteria. Any ideas on what I am doing wrong?
 

michaelm

Member
Licensed User
Longtime User
:sign0060:
Works great. Thank you!

Now how do I put some wildcards in it so that it will find anything with only a partial description. For example: If i wanted to find all rows with the word "apple" but that word could be at the beginning, middle or end of the text.

Please advise.
 

Ariel_Z

Active Member
Licensed User
Replace the " = " signe (equals) with the work " Like ".
Then write in the textbox something like "app*"

Note - remove the brackets from all the above.

The idea is that you must enclose the value itselft in brackets as I demonstrated. The = sign indicates equation (identity). The Like operator indicates the quite wide range of similarities including wildcards.

The filter string is written like a WHERE clause in a SQL statement (eg. ColumnName = Value AND ColumnName2 = Value2).

To make it easier for users, you may want to create a filter builder. You might have a ComboBox loaded with column names, another loaded with operators (=, >, <, <>, etc) and a TextBox for the value. The user selects a column, and operator, and types a value. They click an Add button and you build a filter string.

Let me know how it works...
 
Top