On this Page

    DocumentSort

    This filter allows you to sort your input XML file based on one or more keys. It is quite a fast sort at that! If running the filter standalone it takes the usual -in and -out parameters. When run as a filter via Merge, those parameters are provided automatically. The input will be either the -data file or the output of the previous filter. The output file will be passed on to the next filter, or if none, to Merge.

    -keyName

    -keyName=xmlTagName

    Define which XML fields (tag names) to sort on. There may be one or more.

    Sort key qualifiers

    There are a number of qualifiers that can be applied to each sort key. They must follow the sort key to which they apply. These qualifiers are:

    Qualifier            ValueMeaning
    -sortOrderascending or descendinghow key values are sorted
    -caseSensitive*see noteTreat keys with the different case as different
    -numeric*see noteTreat this key as a numeric. E.g. 2 should come after 10.
    -rightJustify*see noteFor sort purposes, pad this key on the left with blanks until it is the width of the maximum width key for this sort key

    *These are all Boolean settings so, if you are keen on such things, you can add an =Y, =N, =T, =F, =0 or =1 to each of these. The default is =Y. So the setting itself says that you want that action to happen. And the absence of the setting means that you don't want that to happen.

    -numeric and -rightJustify were introduced in 3.0.002.03.

    Filter syntax

    Do recall that as a Merge filter, it is the entire set of parameters for a filter that is simply one large -filter parameter to Merge. So if you are running this as a Merge filter, as opposed to standalone, you would say, preferably in a .prm file, not keyed in by hand on the command line (and notice that the whole set of parameters is within quotes):

    -filter "DocumentSort -keyName=SortTagA -numeric -keyName=SortTag2 -sortOrder=descending"

    A powerful usage

    By doing a fast sort on, say, Branch, or Region, it is very easy to get all the documents out for a Branch|Region together. If you are producing PDF output, using PDFCombineDocuments Yes, you can easily put all of the documents for a Branch|Region into one PDF for easy dissemination.

    See Also

    Multiple Outputs
    Printer options