Hi there,
You can create a page with a DataView of Device first and then populate the DataView with macid and name.
Inside the DataView, you can create a DataGrid of Alert, using XPath
By doing so, you can view, create and edit the alerts that are associated with the device.
On the DataGrid, you can add two buttons: New Alert and Edit
New Alert button should call a microflow like below:
Change action is configured as below:
In this way, the new alert you save in Alert_NewEdit will have an association to the device.
The Edit button on DataGrid can also show Alert_NewEdit page to edit created alerts.
Your final result would look like this:
For your second question:
Mendix automatically handles the keys for you. So you don’t have to worry about managing keys. Also, the references between Device and Alert serves the function of foreign keys.
There may be a better way to do this, but this is what I can come up with currently. Hope this can help you!
Regards,
Jeremy
Hi There,
An addition to the answer of Jeremy
Inside the DataView, add DataGrid of Alert, using database (XPath won't add anything in this situation; unless you need more advanced constraining)
Select over association (in case of using the XPath datasource, same applies)
By doing so, the list of alerts are constrained by the association.
New Alert button will automatically set the association between the device and the new alert. So NO need for an microflow to handle this
Regards, Rene