Help with constraints on datagrid

0
Two objects have a many to many association, object A and object B. After setting off a microflow in object A there are multiple objects B created. I want to have a button which shows a list of all the objects B that are associated with object A. What is the xpath constraint that you need on the datagrid (the datagrid of the list of object Bs) to make this happen? Or is there any other way to achieve this?
asked
3 answers
3

I think your XPath should be:

[Administration.Activities_Treatment = '[%CurrentObject%]']

This requires the datagrid to show entities of type 'Activities' and to be located within a dataview showing a single entity of type 'Treatment'.

If your association is really many-to-many, you can also simply use a reference set selector (instead of a datagrid) in your dataview.

answered
1

I would change my relationship to a 1 to many, then you can retrieve your objects via association. Since I've been using Mendix, I've never seen anyone use a many to many relationship. A many To many means Object B is associated with multiple Objects A and thus it would retrieve information you didn't intend to retrieve.

answered
1

Lets say that ParentEntity is associated with objects in ChildEntity, and that you have a 1 to many association between the two entities called ChildEntity_ParentEntity. If you have a datagrid listing all ParentEntity objects, and want to then display all of the ChildEntity objects association with a given ParentEntity, you could build a webform with a Dataview of ParentEntity, and within that Dataview, a nested DataGrid of ChildEntity which retrieves data via the association (this is the easiest way to accomplish what you want, I think). If you wanted to use an Xpath constraint, it would be [ChildEntityParentEntity - '[%CurrentObject%]']

Hope that helps.

answered