How to create a custom search filter with external database queries
0
Hi to all, I have a mendix app with data from an external SQL database. Now I try to create a search function to filter a datagrid, that searches for one string in several attributes with a like-operator. 1. When I am right, I can't do a like-filtering with a list-filter-operation. 2. And I also can't use an external database query with parameter where the parameter should sometimes be empty / not used. 3. A parameter with a string sentence like "WHERE Abfall_InterneBez LIKE '%' + varSearch + '%' OR Abfall_Bez_Alternativ LIKE '%' + varSearch" is also not working in an external database query. 4. So I have created two external database queries, one with a parameter for the search string. All attributes in this two queries are the same: 5. In a microflow I create an empty list and then have a decision if there is an entry in the search field or not. In the first case I create a list of the parameterized query and add it to the empty list. In the second case I create a list of the non-parameterized query and add it to the empty list. 6. When I do so, I get an error because the list of the parameterized query has not the same type as the other one. How can I solve this? Thank you for your support. Miriam
asked
Miriam Klingen
1 answers
-1
Make sure you're using the same entity as result entity for both queries in the "Response structure "tab of your Database document in App Explorer where you define the query. Now you're using 2 different entities.
Then in your microflow you can set (or add) the results of the same entity to the results list, or directly return the list from the "Query external database" results which would save you an additional step to modify the results list "list_AbfallUebersicht" which you don't need.