Sorting documents You can sort page formatted documents retrieved from a document repository as well as page formatted documents from standard runtime jobs. The documents must be sorted to make sure they arrive in the right order before enveloping is applied. You can, for example, sort the documents using the zip code as the first sort criterion and the customer number as the second sort criterion. This will first group the documents per zip code, and then, within each zip code group, group the documents per customer number. Sort keys Sorting is applied using one or more sort keys, for example zip code and customer number as described in the example above. When you define a sort key, you define which key to use, the type of key (numeric or string), and the sort order (ascending or descending). You use metadata as sort keys and define the sort keys as metadata names. In this section • Defining sort keys