GetPreviousDoc method: Business Interlink class

Syntax

GetPreviousDoc()

Description

The GetPreviousDoc method gets the previous document from either the root level of the Output structure for a Business Interlink object, or from a document within the Output structure. When these documents are in a list, GetPreviousDoc gets the previous document in the list. You must get the document before you can get its values with GetValue.

Parameters

None.

Returns

The following are the possible returns:

Number Enum Value Description

0

eNoError

The method succeeded.

1

eNO_DOCUMENT

The document referenced by this method does not exist.

2

eDOCLIST_OUT_RANGE

You tried to access a document in a list, but the document list is out of range. For example, if a document list contains five documents, and then you call GetDoc/GetOutputDocs once, you can call GetNextDoc four times; the fifth time results in this error.

3

eDOCUMENT_UNINITIALIZED

Internal error

4

eNOT_DOCUMENTTYPE

You tried to perform an operation upon a parameter that is not a document type.

5

eNOT_LISTTYPE

You tried to perform a GetNextDoc or AddNextDoc upon a document that is not a list.

7

eNOT_BASICTYPE

You tried to perform a GetValue or AddValue upon a parameter that is not of basic type: Integer, Float, String, Time, Date, DateTime.

8

eNO_DATA

You tried to retrieve data from a document that contained no data.

Example

In this example, the Output structure for Calculate Cost, or the root level document, is accessed with the GetOutputDocs method. It contains one output parameter, output_param2_List, which is also a list. The GetCount and MoveToDoc methods point to the last output_param2_List document in the list. The GetPreviousDoc method is used in a loop to cycle through the output_param2_List list, starting with the last and ending with the first in the list, and get each output_param2_List document and its values.

Local Interlink &QE_COST; 
Local number &count; 
Local BIDocs &CalcCostOut; 
Local BIDocs &OutlistDoc; 
Local number &ret; 
&QE_COST = GetInterlink(Interlink.QE_COST_EX); 
// Get inputs, execute. (code not shown) 
&CalcCostOut = &QE_COST.GetOutputDocs(""); 
/* Call GetValue for output_param1, call GetDoc, GetValue for Service_Rate (code⇒
 not shown) */ 
&OutlistDoc = &CalcCostOut.GetDoc("output_param2_List"); 
&count = &CalcCostOut.GetCount("output_param2_List"); 
&ret = &OutlistDoc.MoveToDoc(&count-1); 
&I = &count; 
While (&I > 0) 
   &ret = &OutlistDoc.GetValue("output_member1", &VALUE1); 
   &ret = &OutlistDoc.GetValue("output_member2", &VALUE2); 
   If &ret = 0 Then 
      /* Process output values */ 
      &I = &I - 1; 
      &retoutput = &OutlistDoc.GetPreviousDoc(""); 
   End-If; 
End-While; 

The following shows the Output structure for this example. It contains three output parameters: output_param1, Service_Rate, and output_param2_List.

Example output structure