Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | DSPs and building output templates | Using Dynamic Server Pages (DSPs) | Using the DSP Tags | Extracting Results from an Array Variable
 
Extracting Results from an Array Variable
If a service returns an array variable—such as a String list, a String table, or a document list—to a DSP, you use the %loop% tag with a variableName to extract values from the elements in the array.
When you use %loop% on a document variable, the scope within the loop block automatically changes to encompass just those elements within the specified document.
The following example shows a loop that extracts values from a document list (called items) that is returned by the service named orders:getOrderInfo.
%invoke orders:getOrderInfo%
<P>This shipment contains the following items</P>
<TABLE WIDTH="90%" BORDER="1">
<TR><TD>Number</TD><TD>Qty</TD><TD>Description</TD><TD>Status</TD></TR>

%loop items%
<TR>
<TD>%value stockNum%</TD>
<TD>%value qty%</TD>
<TD>%value description%</TD>
<TD>%value status%</TD>
</TR>
%endloop%

</TABLE>
%endinvoke%
.
.
.
For additional information about the %loop% tag, see the %loop% tag description on %loop%.