Database connector dynamic query

I have a SearchApp with few text inputs for a user (name, lastName, address etc.) to filter the database. In my connector I have a huge query with few table joins and a lot of conditions. Point is I added all those conditions, because if user inputs value to all of the fields then they are necessary, but if user inputs only a name and leaves every other field empty then those conditions are unnecessary and I could send just a simple query to the database, instead I’m doing 5 joins with 10 conditions that are gonna evaluate to true anyway.

I want to dynamically change query of the connector, something like:

if (nameTextInput != null)
    query.append("WHERE name = " + nameTextInput);

You get the idea. Is that possible?

Hi Hara,

where is the connector running?
On MWS or IS?

Which wM Version are you using?


Hi, it’s running on MWS and wm version is 9.5.

HI Hara,

You must be using IS adapter to run the query on the back end. And the query is built on UI.

Using dynamic query adapter should suffice your needs.