Mendix 7 - problem with mx.data.get and filter.references

3
Hallo, in our custom widgets we use the filter.references option of the mx.data.get, in order to be able to reach from a mendix object not only the guid of another mxObj (associated to the first one) but also its attributes. Once the object is retrieved using the filter.references, mxObj.get("mxObj1_mxObj2") used to return an object, containing, among others, the keys 'attributes' and guid, so that for example the command mxObj.get("mxObj1_mxObj2").attributes['Name'].value  used to return the value of the attribute name of the second obj. Running the same project in Mendix 7, we got several errors, since the line mxObj.get("mxObj1_mxObj2") now returns only the id of the refered object, even if, for what I can see, mxObj contains exactly the same amount of information as before. I could not find any comment about these changes in the release notes of mendix 7 (a change on the get function is mentioned, but not about how to use filter.references); also in the description of mx.data.get there is a reference to 'options' for the argument filter.references, but I could not find any further documentation. I would be very grateful if you could point me out any possible solution or any extra documentation for this options. Thank you in advance.
asked
2 answers
0

Hi Lucia,

Our R&D department took a look and had the following to say:

This behavior change is documented in the Mendix 7.0.2 release notes as "The semantics have changed for MxObject.get and mx.parser.parseValue" Currently they behave as documented in apidocs, while previously the behavior for reference attributes was unspecified => use on your own risk.

The correct way of obtaining the behavior they want is (and always was): EntityToRetrieve.fetch("MyFirstModule.EntityToRetrieve_ReferedEntity/MyFirstModule.ReferedEntity/Attribute", function(value) { ... })

Hope this clarifies things.

answered
0

Thank you for your answer.

The difference between using the fetch function as suggested, and using the get function as it used to work in Mx 6 is that the fetch function seems to require an extra call to server, with callback, that was what we were trying to avoid in order to improve performances.

Also it is still not clear to me which 'options' are available on the filter references (see the documentation for mx.data.get, the description of filter.references, https://apidocs.mendix.com/7/client/mx.data.html#.get).  

Regards,

Lucia Tealdi

answered