I would recommend creating an event handler for the event "BeforeSaveModel". The example below implements a simple event handler that, when the event is triggered, triggers the standard cardinality check of ADOxx. During this check, all cardinality errors will be shown to the user in a separate information box. In the end, if any cardinality errors have been found, a warning box is displayed, asking the user if they still want to save the model. Unfortunately, the current implementation of the cardinality check does not allow the developer catch all the error messages and display them in one single dialog, but we have created a Change Request regarding this issue for a future version of ADOxx.
1ON_EVENT "BeforeSaveModel"
2{
3# modelid, origin: "new"("Model" - "New"), "saveas-new" ("Model"- "Save as" Part 1), "save" ("Model" - "Save")and "saveas-save" ("Model" - "Save as" Part
42).
5# Exit Values: 0 - no abortion, -1 - abortion without error, -2 - abortion with error, >0 - abort with core error code.
6
7CC "Modeling" CHECK_CARDINALITIES modelid: ( modelid ) nosuccessmessage
8# --> RESULT ecode: intValue
9
10IF (ecode) {
11 CC "AdoScript" WARNINGBOX "Cardinality check has failed.\n\nDo you still want to save your model?" title: "Cardinality check failure" yes-no
12 IF ( endbutton = "yes") {
13 EXIT 0
14 }
15 ELSE {
16 EXIT -1
17 }
18}
19}