Dynamic Datagrid - Custom Find/Search Operation

I'm trying to do something (I think) very basic but I can't figure out the right approach to it, and there doesn't seem to be much documentation along this use-case. I would just like to create a basic search/find screen. A user will enter some text, click a button, and the Datagrid will refresh based on the results that are returned. I don't want to search on values that are already contained within the Datagrid. I want the text that is input to be passed to a Java action, which will then make a REST call and return a list. Then if they search again with different criteria, all that data should be removed, and the new list that is returned should now populate the Datagrid. Is this possible using the Mendix platform? Again, I feel like it should be pretty basic, but I don't see any examples in the documentation.
2 answers

You can this with a two entities: searchrequest and searchresult (1:n). The form contains a dataview with searchrequest and a datagrid over the association to searchresult(s). Your search code has to create searchresult objects. Second search has to delete the previous searchresults objects or create a new searchreq+results set.

Actually you use Mendix to pass data, from and to the search engine.

Edit 1: rough guideline:.

  • New Project,
  • Go to domain model, A
  • Add 2 entities, searchrequest and searchresult.
  • Draw a line from searchresult to searchrequest.
  • Create a JavaAction named search, input object searchrequest, result list of searchresult.
  • Deploy for eclipse.
  • Use Eclipse to edit the action: search.
  • Do your Rest code.

Get the results (pseudocode);

  sr = new searchresult(getContext());
  return result
  • Create a microflow
  • Call javaaction
  • Create the microflow from the form.

EDIT 2: You can delete beforehand in the microflow the Mendix way. Alternative in Java, something like.

String searchrequestEntityName = searchresult.entityName;
        String relationName = searchrequest.MemberNames.searchrequest_searchresult.toString();
        String currentObjectID = searchrequest.getId().toLong();
    List<searchresult> currentresults = Core.retrieveXPathQueryEscaped(context, "//%s[%s='%s']", attachmentEntityName, relationName, currentObjectID);
For (searachresult sc : currentresults) {


I have a related question to the Data View with nested Data Grid over association. Suppose I create the List of Results in Mendix Microflow, how do I inject this List of Results through the association to the entity on which I created my View?

Right now, the way I do it is as follows in a Microflow but the grid won't show anything:

  1. Create SearchRequest
  2. Retrieve List of SearchResult by Association SearchResult_SearchRequest
  3. Create SearchResult1 (with some dummy values)
  4. Create SearchResult2 (with some more dummy values)
  5. Add SearchResult1 to ListOfSearchResult
  6. Add SearchResult2 to ListOfSearchResult
  7. Show Form (which contains Data View on SearchRequest with a nested Data Grid on SearchREsult by Association)
  8. The page does not have any values in the grid

Edit1: Forgot to mention that I tried it on the Mendix 5 beta 6 and not beta 7.