Filter database query with with info inside the input text and repeat region

I hope someone can help me here.

I have a query based on text input: “filter” and “location”

I stated multiple conditions:
subcategories contain “filter” and city begin with “location”
Service contain “filter” and city begin with “location”
Company name contain “Filter” and city begin with “location”

When the query work when write the subcategories or services, company. However, it display two separate info when I type the company name.
I would like to be able to type the company name and display only the company name but all the services with the company name together. I also would like to avoid the duplicated query when search for company name because it display separately the name of the company and each service.

Is there anyway I can request subcategories and services in the same text input field such as Restaurant taco.

Any recommendation will be very useful.


Can you send all screenshots of your query,
Including the Global $_GET or $_POST variables, the tables you are querying, and most importantly the condition steps of the query, so we can try to advise.

Hello psweb,
Sorry for the late reply, I was sleeping with the time zone difference.
Maybe you can see something to guide me. Thank you again.

Ok, to me right away it looks like it could be something to do with the contains operator, however, I am unsure, but we have another person that has condition steps that look pretty similar, let’s see if he can assist.
@TomD, lol, your’e up on this one, haha
Edit or @Hyperbytes with all those MySql LIKEs

Yup! I am up at this time.

If I understand the issue correctly, I use queries like this a lot. Eg where you have a keyword field, which will search multiple fields for multiple words.

I put the query string (contents of the keyword field) into an array and use the resulting strings in separate blocks of conditions in the query. Eg so someone could use ‘Aust J Pride Prej’ to find a well-know book. The beginning of the query might be:

… where ‘search’ is a variable based on the GET variable sent from the form. I do this to modify the submitted value before using it in the query, eg:

{{$_GET.keywords.replace("+", " ").replace("%2B", " ")}}
(obviously you could strip out other characters or punctuation etc.)

I usually allow just a few keywords - partly because I don’t want the query to become endlessly long, and also, because it’s rarely useful. I sometimes display a modal if too many words are entered, to warn the user and to give them some search tips.

There may be a better way of doing this - eg using a loop to go through each keyword, but I tried in the early days of Wappler and couldn’t get it to work, but I should probably try again some time. As it is, this method works well and even with a great many conditions, the search is very fast.

Using conditions like this you can use a single query for a keyword search, advanced search, category search etc. on the same results page.

1 Like

Hello TomD,

If you see the first image; When I type taco - I receive the query of two company because both provide Taco. When I include the location; the filter applied the location query.
However, when I type the name of the company:
It provides the name of the company but divided into the number of services for the company.
I am trying to have the company name once and then list the services into the company query display and align like taco, basket.

Now, the next step will be to allow multiple keyword in the text input field company name and services like you stated.

Sorry - I did misunderstand you question. It may be useful to look at this documentation on nested repeat regions.

Another way you could get the result you want is to use a hide condition:
hide the company name if its index is the same as the previous one, eg:

dmx-hide="[$index].company_name ==[$index-1].company_name && $index != 0"

Thank you. I am working on the structure of the nested repeat region and will give you a result. If it s worked.

@psweb @TomD Thank you so much! The nested repeat regions did the job I was looking for. I have to create a new logic to display the data using nested repeat regions.

1 Like