Searching in database with keywords

Searching in database with keywords

  
Hi! I have a field where the user can input keywords, separated by comma. Ok, I assign this to a text variable. How do I create a query using those keywords, like the example below:

field like '%keyword1%' or field like '%keyword2%' or field like '%keyword3%'

*I'm already using the Split ad-on and the number of keywords is variable, so I'm using a for each.
Do I need to use the Advanced Query for that?
Hi,

You can do it inside a simple query's using a restriction with something like :

table.fieldname1 Like "%"+ Keyword1 + "%" or
table.fieldname2 Like "%"+ Keyword2 "%" or
table.fieldname3 Like "%"+ Keyword3+ "%"
Sorry, but this is not what I want because I don't have the number os keywords.

The cenario is like this:

There's one text field, where the user inputs in it some keyworks separated by comma. (there's no fixed quantity of keyworkds! Can be 1 or 10)

In the action, I assign the value typed to a text variable.

VarKeywords = "Keyword1, Keyword2, Keyword3"

Having this, I need to, internally, split the keywords and for each keyword, I must generate the query below.

(table.fieldname1 Like "%"+ Keyword1 + "%" or
table.fieldname2 Like "%"+ Keyword2 "%" or
table.fieldname3 Like "%"+ Keyword3+ "%")

How do I make a For-each inside the Query Editor?
I think would be better to limit the keywords for 4-5. So there would be easy.
One way to do what you want: add an auxiliary entity to your database, in order to keep the keys.

When you have something like keywords = "key1, key2, ..., Keyn" you will have n new entries in the table suggested.

Now, the query you are interested in, is the same as a join between the tables involved.

Take care with the fact that many searches can be made at the same time, which means that your new table should include an attribute that identify the search.