GetStringArray method: OptEngine class
Syntax
GetStringArray(PARAM_NAME)
Description
This method gets the value of a transaction output parameter with a data type Array of String. This cannot be used with the RunAsynch method; RunSynch is needed to make the transaction output parameter values immediately available.
The DetailedStatus OptEngine property indicates the completion status of the OptEngine method call GetStringArray. For GetStringArray, DetailedStatus can have the value:
-
%OptEng_Success.
-
%OptEng_Fail.
-
%OptEng_Method_Disabled: indicates that the method is disabled or not valid.
Parameters
| Parameter | Description |
|---|---|
|
PARAM_NAME |
Enter a string for the name of the output parameter to get from the transaction that was just performed with RunSynch. This parameter must be defined as an output or both (input and output) in the analytic type definition. See Optimization Framework: Configuring Analytic Type Transactions. |
Returns
Returns an Array of String object; use this method when that is the data type of the transaction output parameter value.
Example
The following PeopleCode example runs a synchronous optimization transaction named ARE_MACHINES_AVAILABLE. It has these parameters:
-
Inputs BEGIN_DATE and END_DATE to specify the time slot.
-
Output MACHINE_NAMES to specify the machines available in that time slot.
This PeopleCode example sets input parameter values and gets an output parameter value:
Local OptEngine &myopt;
Local integer &status;
Local array of string &machnames;
Local datetime &begindate;
Local datetime &enddate;
&myopt = GetOptEngine("PATSMITH");
&begindate = QEOPT_WRK.BEGIN_DATE.Value;
&enddate = QEOPT_WRK.END_DATE.Value;
/* Run the ARE_MACHINES_AVAILABLE transaction synchronously with input values. */
&status = &myopt.RunSynch("ARE_MACHINES_AVAILABLE",
"BEGIN_DATE", &begindate, "END_DATE", &enddate);
If &status=%OptEng_Fail Then
QEOPT_WRK.MESSAGE_TEXT = "ARE_MACHINES_AVAILABLE transaction failed.";
Return;
End-If;
/* Get output value from the ARE_MACHINES_AVAILABLE transaction. */
&machnames = &myopt.GetStringArray("MACHINE_NAMES");
The following example shows the use of the DetailedStatus property:
Local array of string &machnames;
&machnames = &myopt.GetStringArray("MACHINE_NAMES");
if &myopt.DetailedStatus=%OptEng_Fail then
/* perform some action */
End-if;