New to Mendix - one on one relationship

2
I have a one on one relationship on my data model. This is between request header and request detail. When I entered the data from the page, the link between the two didn't seem to be established automatically. Not only that, I was able to enter more than one detail. What did I do wrong?
asked
2 answers
3

It looks like you are just creating new _detail entities, which, as you already mentioned, are not associated tot the _header. To associate the _detail with the _header, create an "action" button, which triggers a microflow. In this microflow you have the _header as input parameter. Now you could create a new _detail and associate it with the _header. Next, direct the microflow to the _NewEdit page.

Furthermore, it looks like _header is caller of the page and there you have a datagrid of _detail. You should constraint your datagrid to show only the details which belong to this header. Please try it yourself first, otherwise I could help you.

PS. Since the association is 1-1, you could also use a dataview with a microflow datasource to retrieve the _detail entity. A datagrid is used for multiple entities.

answered
0

Another comment, posted in a separate post because the context is different: what is the purpose of the user entity?

If you want to register which users (with username and password) are doing request, you should make the user entity a specialization of the user entity in the System module.

answered