DeleteOptProbInst function

Syntax

DeleteOptProbInst(probinst[, &detailedstatus])

Description

The DeleteOptProbInst function deletes the analytic instance ID from PeopleTools metadata. This function can be called only inside FieldChange, PreSaveChange and PostSaveChange PeopleCode events, and in Workflow.

Note:

Use this function to delete the analytic instance ID after deleting data in optimization application tables for this analytic instance.

Parameters

Parameter Description

probinst

Enter the analytic instance ID to delete.

&detailedstatus

(Optional) This status reference parameter returns an integer value giving further information about the evaluation of this function. The value returned is one of the following:

  • %OptEng_Success: The function completed successfully.

  • %OptEng_Fail: The function failed.

  • %OptEng_Invalid_Piid: The analytic instance ID passed to the function is invalid.

  • %OptEng_Sql_Exception: A SQLerror is encountered when access database.

  • %OptEng_Exists: An analytic server loaded with this analytic instance still exists.

Returns

Returns %OptEng_Success if successful; otherwise returns %OptEng_Fail.

Example

The following example deletes the instance for an analytic type:

Note:

Whenever you add records to an analytic type, you must call DeleteOptProbInst to delete the old analytic type instances and then call InsertOptProbInst to recreate them.

Local string &probinst;
Local string &probtype;
Local integer &ret;
&probinst = "PATSMITH";
&probtype = "QEOPT";
&ret = DeleteOptProbInst(&probinst, &probtype);
If &ret <> %OptEng_Success  Then
   QEOPT_WRK.MESSAGE_TEXT = "Delete of analytic instance " | &probinst | "
 failed.";
Else
   QEOPT_WRK.MESSAGE_TEXT = "Analytic Instance " | &probinst | " deleted.";
End-If;

The following example shows the use of the optional status parameter:

Local integer &detailedstatus;
&ret = DeleteOptProbInst(&probinst, &probtype, &detailedstatus);
If &ret <> %OptEng_Success  AND &detailedstatus=%OptEng_Invalid_Piid then
   QEOPT_WRK.MESSAGE_TEXT = "Delete of analytic instance " | &probinst | " failed 
for bad piid.";
Else
   QEOPT_WRK.MESSAGE_TEXT = "Analytic Instance " | &probinst | deleted.";
End-If;