Integration Cloud 6.6.0 | Built-In Services | Built-In Services | sortDocuments
 
sortDocuments
Sorts a set of input documents based on the specified sortCriteria.
Input Parameters
documents
Document List Set of documents that are to be sorted.
sortCriteria
Document List Criteria based on which the documents in the documents parameter are to be sorted.
Valid values for sortCriteria parameters are:
*key. Name of the element in documentList whose value provides the value based on which the documents are to be sorted. The value for key can be a path expression. For example, "Family/Chidren[0]/BirthDate" retrieves the birthday of the first child from the input Family document list.
*order. Optional. Allowed values are ascending and descending. The default value is ascending.
*compareStringsAs. Optional. Allowed values are string, numeric, and datetime. Default value is string.
*pattern. Optional. The value for pattern will be considered only if the compareStringsAs value is of type datetime.
Note:
If key is not found in all the input documents, the sorted list of documents appears at the end or start of the list based on the order specified. If the order is ascending, then all the documents that do not match the sort criteria appears at the top of the list, followed by the sorted list. If the order is descending, the sorted list will appear at the top, followed by the documents that do not match the sort criteria.
Output Parameters
documents
Document List The documents sorted based on the sort criteria specified in the sortCriteria parameter.
Usage Notes
For example, if you want to sort a set of documents based on name, age, and then on birth date, the values for sortCriteria parameter would be:
key
order
compareStringsAs
pattern
Name
ascending
string
Age
descending
numeric
Birthdate
ascending
datetime
yyyy-MM-dd