Many to many relationship and drop down reference selector.

Assuming a many to many relationship between entity A and entity B. Having a page with a data view of an entity A object, I can view attributes of that specific object. Inside that data view I want to have another data view with detailed info of an associated entity B object. The specific entity B object to display the data of should be selectable using a drop down above the entity B data view. Is this possible? If so, is there an example? The problem is not making associations between entity A and B objects using a reference set selector. What I have difficulty with is to achieve a populated drop down where I can select associated entity b objects to display in the nested data view.
3 answers


You can do this with a combination of the answers given by Ronald and Niels: - Entity A and Entity B - Reference Set A-B (lets call this AAllAssociatedB - Reference A-B (lets call this ASelectedB

Now in your Dataview A, you can place a reference selector pointing to ASelectedB. This reference selector can constrain the possible values to all instances of B contained in AAllAsociatedB. This constraint can be either via Constrained By or by XPath.

With this structure, you can have a dataview that displays Object B from the A_SelectedB association, and when you select a new B in the reference selector, this dataview should update (you may need an onchange microflow on that reference selector that commits Object A in order to display the newly selected Object B.

As Niels mentioned, you will have to create a way to maintain the AAllAssociatedB reference set. If that reference set is empty, you won't see any possible selections in the reference selector for ASelectedB.



Did you check the constrained by function? Because if I understand correctly you use a dropdown to select entity A and then another dropdown for the entity B, And the selection possibilities of B should be constrained by what is selected in A.




I think you can create a one to many relation ship (and maintain it in the background to allways match all your many to many relationships). Then show the chosen entity with a listens to data view. I think something like this should work (allthough it requires some extra relation maintenance)