Sorting options

This page appears as part of the Advanced Print Wizard and the Job Creation Presets Wizard.

The Sorting Options page is used to sort the records in the output. Sorting is done from the top to the bottom, one after the other.

Sorting Settings

  • Use standard sort: Sort using the fields below:
    • Field Name: Use the drop-down to select which field to sort on.
    • Order: Use the drop-down to choose Ascending or Descending.
    • Add: Click to add a new row to the sort list. The list that appears contains all the fields in the Data Model, as well as a special <Document Length> option which is used to sort by the number of pages in each document.
    • Delete: Click to delete the currently selected row in the list.
    • / Move up / down: Click to move the currently selected row up or down within the list.
  • Use external sort: Sort the records using some external sorting software. A CSV file is exported, then sorted by the external application and the resultant sorted CSV file is returned and integrated, with all the records now being sorted according to the new order within the CSV file.
    External Sort commands must return a non-zero error code if an error occurs.

    An external sort command could easily fail part way through processing and generate only a partial output file. Without receiving a return code from the external sort process, PlanetPress Connect cannot know if the sort has successfully completed or not. Thus the sort program must generate a return code, with a code of zero ('0') indicating success, and all non-zero results indicating failure.
  • External Sort Settings group:
    This section of the dialog is only activated if the Use external sort option has been selected.
    • Command: Enter either the full path of the executable file that will sort the CSV file, or a valid Windows command line instruction to sort the records.

      Placeholders can be used within this command, and are available via the Insert input/output file placeholder options (expressed as either ${input} or ${output}) or via Job Creation runtime Parameters (expressed as ${params.xxxx}, where the xxxx is the name of the runtime parameter).

    • The Windows command line instruction should do something like the following:
      1. Do some processing of the input CSV file which PlanetPress Connect will pass through in the position of the ${input} placeholder.
      2. Generate an output file that contains the sorted data and must be named according the file name PlanetPress Connect will pass through in the position of the ${output} placeholder

      For example: cmd /C sort /R ${input} ${output}
      This would reverse the order of the ${input} file, and sent the output to the ${output} file.
    • Timeout: Enter the number of seconds to wait for an external sort command to complete before abandoning the external sort.
    • Separator: Enter the field separator used in the CSV file, such as a comma (,), pipe (|), semicolon (;), etc.

    • Quote Character: Enter the quoting character that wraps around any field that contains the separator.
    • Escape Character: Enter the character use to escape the Quote character if it appears in the field value.
    • Line Ending: Use the drop-down to select which line ending to use. The selections are: Windows Carriage Return/Line Feed combination (CRLF), Linux Line Feed (LF) or Apple Macintosh Carriage Return (CR).
    • Character Set: Use the drop-down to select which character set to use when encoding the CSV file. This always defaults to UTF-8, as this caters for all possible characters, is relatively compact (in terms of Unicode character sets) and is compatible with standard ASCII.
    • Exported sort data group:
      • First row of sort data has field names checkbox: select to have field names placed on the first line of the exported CSV file.
      • Fields to export: Lists the fields to export in the CSV file. The buttons to the right of the table provide the following functionality:
        • Click to select from available datatfields. The Field Selection dialog will appear, which allows selection of one or several fields from those available.
        • Click to remove a field from the list.
        • / Click to move fields up or down in the order of output.
      • Record ID Field: The Record ID field is a database Primary Key field, which is automatically added to the exported data file. The Record ID field name defaults to RecID, but can be changed here as desired.
    • Processing returns data group: This allows the external sort application to introduce new data for each record. This data can be embedded in the metadata and used as the source for additional content within PlanetPress Connect.
      An example usage would be generating a postcode or postal barcode data from address details, making it available for use in PlanetPress Connect.
      • Processing returns data checkbox: Select this if the sort processing will be returning data. This activates the whole optional Processing returns data subsection.
      • First row of return data has field names checkbox: select to have field names placed on the first line of the returning datafile.
      • Return Fields: Lists the fields available in the selected data mapping configuration that can be used to sort the records. Fields can be added or removed by use of the add datafield () and remove datafield () buttons, or re-arranged with the arrow buttons (/ ).
        Field names can be altered by selecting the field in the table, and editing the name.
        Fields can be made available to PlanetPress Connect via the "Include in meta data" checkbox. Click the checkbox beside the field name to make that datafield available as meta data.

      • Record ID Field selection box: Select which return field is to be the Record ID field.
      • Sorting by selection box: Select whether the sorting will be by the returned sort order or whether it is to be sorted on a selected datafield.
        • Sequence Field selection box: Select the datafield to be sorted on, if such was chosen in the Sorting by entry.