pub.document:documentListToDocument
WmPublic. Constructs a document (an IData object) from a document list (an IData[ ]) by generating key/value pairs from the values of two elements that you specify in the document list.
Input Parameters
documentList | Document List Set of documents (IData[ ]) that you want to transform into a single document (IData object). Note: If the documentList parameter contains a single document instead of a Document List, the documentListToDocument service does nothing. |
name | String Name of the element in the documentList parameter whose value provides the name of each key in the resulting document. Important: The data type of the element that you specify in the name parameter must be String. |
value | String Name of the element in the documentList parameter whose values will be assigned to the keys specified in name. This element can be of any data type. |
Output Parameters
document | Document Document (IData object) containing the key/value pairs generated from the documentList parameter. |
Usage Notes
The following example illustrates how the documentListToDocument service would convert a document list that contains three documents to a single document containing three key/value pairs. When you use the documentListToDocument service, you specify which two elements from the source list are to be transformed into the keys and values in the output document. In the following example, the values from the pName elements in the source list are transformed into key names, and the values from the pValue elements are transformed into the values for these keys.
A documentList containing these three documents:
Overview on how the documentListToDocument service would convert a document list that contains three documents to a single document containing three key/value pairs.
Key | Value |
pName | cx_timeout |
pValue | 1000 |
Key | Value |
pName | cx_max |
pValue | 2500 |
Key | Value |
pName | cx_min |
pValue | 10 |
Would be converted to a document containing these three key:
Key | Value |
cx_timeout | 1000 |
cx_max | 2500 |
cx_min | 10 |