DEFINE VARIABLE cErrorMsg AS CHARACTER NO-UNDO.
DEFINE VARIABLE cList AS CHARACTER NO-UNDO. DEFINE VARIABLE hProc AS HANDLE NO-UNDO. /* Start the importing procedure */ RUN auditing/_imp-policies.p PERSISTENT SET hProc. /* Try to load the file and save the changes into the database */ RUN import-xml-db IN hProc (INPUT "text.xml", /* XML file name */ INPUT "sports2000", /* logical db name */ INPUT TRUE, /* wait on lock */ INPUT FALSE, /* override existing policies */ OUTPUT cList, /* list of duplicate policies */ OUTPUT cErrorMsg). /* Check if there was an error */ IF cErrorMsg = "":U THEN DO: IF cList <> "":U THEN DO: MESSAGE "The following policies already exist: " cList SKIP "Do you want to override them? (If you answer yes, the tool will" SKIP "delete the listed policies before importing them)" VIEW-AS ALERT-BOX QUESTION BUTTON YES-NO UPDATE lChoice AS LOGICAL. /* If the user wants to override policies, need to call save-changes-to-db to get them saved */ IF lChoice THEN DO: RUN save-changes-to-db IN hProc (INPUT "sports2000", /* logical db name */ INPUT TRUE, /* wait on lock */ OUTPUT cErrorMsg). IF cErrorMsg <> "" THEN /* an error occurred */ MESSAGE cErrorMsg VIEW-AS ALERT-BOX. END. END. END. ELSE /* An error occurred */ MESSAGE cErrorMsg VIEW-AS ALERT-BOX ERROR. /* Clean up the procedure and delete it */ RUN cleanup IN hProc. DELETE PROCEDURE hProc. |