InsertOptProbInst function

Syntax

InsertOptProbInst(probinst, ProblemType[, &detailedstatus] [,Description])

Description

The InsertOptProbInst function inserts a new analytic instance ID into the PeopleTools metadata.

The InsertOptProbInst function can be called only inside FieldChange, PreSave and PostSave PeopleCode events, and in Workflow.

Note:

You must use this function to create the analytic instance ID before inserting data into optimization application tables for this analytic instance.

Parameters

Parameter Description

probinst

Enter the analytic instance ID to be inserted into the analytic type.

ProblemType

Enter the name of the analytic type that you created in Application Designer.

&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.

Description

(Optional) Specify a description for the analytic instance. This parameter takes a string value.

Returns

This method returns a constant. Valid values are:

Value Description

%OptEng_Success

Returned if method succeeds.

%OptEng_Fail

Returned if the method fails.

Example

Local string &probinst;
Local string &probtype;
Local integer &ret;
Local integer &detailedstatus;

&probinst = "PATSMITH";
&probtype = "QEOPT";
&probDescr = "New QEOPT instance"; 
&ret = InsertOptProbInst(&probinst, &probtype, &probDescr);
If &ret <> %OptEng_Success Then
   QEOPT_WRK.MESSAGE_TEXT = "Insert of analytic instance "
 | &probinst | " failed.";
Else
   QEOPT_WRK.MESSAGE_TEXT = "Analytic Instance " | &probinst | " created.";
End-If;

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

&ret = InsertOptProbInst(&probinst, &probtype, &detailedstatus);
If &ret <> %OptEng_Success and &detailedstatus=%OptEng_Invalid_Piid Then
   QEOPT_WRK.MESSAGE_TEXT = "Insert of analytic instance "
 | &probinst | " failed for bad piid.";
End-if;