Whats the best approach for a recursive parent-child association with inclusion of info about the association
I have an m-n (recursive) association for an entitiy topic, but I need to store additional information about this association as well, like who created it, date created, remarks, etc. I have now created a separate entity HasRelationWith for that, with both a parent and a child assoclation to Topic and the additional attributes. Is this the best approach? I would like also to have the possibiltiy for a kind of reference set selector when creating HAsRelationWith for a parent Topic with multiple children Topics at the same time. How could I do that?
An entity with parent and child association is a good solution.
For the GUI to look like a reference set you add a grid with a microflow button called add. That button opens a form with a grid (your custom select form) and on that form is also a microflow button that retrieves the list of selected items and in which you create the relations.
The separate entity seems fine to me.
You can put a datagrid on the page that follows one of the associations to show HasRelationWith objects for a given Topic. Or use a microflow as datasource for that datagrid if you need more control over the objects shown.
To select multiple Topic objects create another page:
Starts with a dataview on Topic (the parent topic for which child topics are to be selected)
Shows a datagrid with Topic objects that may be selected as child topic and allows multiple selection.
To connect the topics, use a microflow button that receives the data grid selection and the parent object. This way you can link them. You may need to use a datasource microflow for your selection page if the end user may not select just any topic.
Be careful when creating a new topic and linking it to existing topics. You may run into the auto commit pitfall as described in this topic: