Can I search the multiple field records with single field input?

2
Hi, In general, we all are using search fileds to search the records in the data grid. Can we search the records in all fields with a single field search. For e.g., If I have Name, Street, City, State, Phone fields in my entity. Now I am able to search the records with name, street, city, state and phone with search fields in data grid individually. Now I want to search all the records that contains my input in a single search field. How can I approch this? Please help me in this. I hope I am clear from my end. If not please let me know.   Thanks, Venkat.
asked
4 answers
2

Venkat

Recently, there was a widget added to the app store called Grid Search, which does just what you want.  One search box for a datagrid that searches across multiple attributes.

Mike

answered
6

You could use a listview. It has a single search field where you can add several attributes to search on. If you want to use a datagrid, do the following:

- Download the app store widget Search input widget.

- Create an object (helper) with attribute search (string), show this object in a dataview. You could have a datasource microflow to create this object.

- Use a microflow connected to the widget to filter your objects based on your input. So your retrieve all your objects where the search input matches the value of your objects attributes that you define.

- Associate the search results to your object helper.

- Show the datagrid with an association to the dataview object. (Your current object).

I hope this helps.

answered
2

Hi Venkat,

 

Robert gives a great answer. I would like to suggest a more dirty apporach, but depending on your scenario might do the trick.

 

Create a string attribute e.g. "SearchString" and set it in a before commit event like so

$SearchString = $Adress+' '+$Phone+' '+$Email ....

 

You should not show this attribute in the grid. instead only use in the search field.

Hope this helps,

Andrej

PS: This will store each field that you want to search by one additional time.

PSS: here is the BCo microflow  https://modelshare.mendix.com/models/9c28c589-3c3f-4c71-b2a0-c53c1870fd9c/bco-contact-search-on-multiple-fields

answered
2

Another more advanced suggestion would be to implement a lucene text search integration. That way you can use wildcards, search in referenced records etc in one go.

answered