Retrieving Data on the Client and the Mystery of the Schema-ID

In a widget I am building I need to return N-deep data from the server. Currently, I can accomplish only a single layer of depth when retrieving data client-side via and specifying the references field. However, it seems that this field is not recursive, i.e. I cannot specify references inside this which to also pull. For example, I want to pull a list of User entities, their Companies (company name only) and their Company's Boss (again, name only). It would be great if there is something along the lines of: (I apologize for the horrid formatting - previewing and markdown tools are not functioning well on my browser).{ xpath: "//User.User", filter : { references : { "User.UserCompany" : { attributes : ["Name"], // The below property is not evaluated references : { "Company.CompanyBoss" : { attributes : ["Name"]} } } } } }); However, as I have noted, the above code does not give me the 2nd layer of association. I am having trouble finding any documentation on if this is even possible via My last point is that Mendix, of course, is able to do this using a schema-id, some sort of GUID best I can tell. Inside this id lies the data that is needed to, for example, populate data for a Data Grid. Can anyone either expound on the API for getting N-deep association data, or explain how to generate a schema id? EDIT: I just realized that the schema-id is determined at compile time and stored in the html markup of forms. I wonder if the process could be replicated at run-time?
3 answers

Hi Jason,

The schema id is indeed generated at compile time for built-in widget, and cannot be reused with custom widgets. Personally I thought that either or could handle arbitrary depth of associations for custom schema's, but I couldn't find it back in the official documentation.

If your retrieval is always maxed at depth two, you might also retrieve the in-between-entity (Company in your example) as start entity of your query, and apply the xpath constraint you want over the assiociation to the entity you really wanted to retrieve (e.g. CompanyUser/User[original constraint], and add the two references two both user and boss in your schema. You need to post process the result in this work around, but at least you should be able to retrieve everything in one query.


Retrieving data from 2+ level deep can be done in a widget (in pseudo code)

  1. Retrieve the first level (optionally with schema like you do)
  2. From the result get the associated object guid obj.get("User_CompanyBoss")
  3. Do a new retrieve with args (Entity "Company.Company", Guid=Guid from line 2)

If you want to make it more generic get the entitytype from the meta data api.


I was actually able to find some kind of a work-around but it is very custom and uses some of Mendix's runtime interfaces.

Essentially, I stringified some parameters to send to a MF. The MF calls a Java action which sends a GET request to the server, specifying the schema of the information I want. It's a little more low level than basic XPath and it may or may not be supported.

For anyone who is interested, however, this is some example code:

    LocalComponent c = getComponent();
    ConnectionBus cb = c.connectionBus();
    IXPathTextGetRequest localIXPathTextGetRequest = cb.createXPathTextGetRequest();
    IRetrievalSchema schema = cb.createRetrievalSchema();

    // Schema creation
    schema.addSortExpression(, SortDirection.ASC);

    // Add associative schemas
    IRetrievalSchema sample = cb.createRetrievalSchema();

    // Add associations to main schema


      IDataSet localIDataSet = cb.doRequest(this.getContext(), localIXPathTextGetRequest);