Sorting Options
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, sorted by the external application and the sorted CSV file is returned and integrated, with the records now sorted according to the new order in 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. - Command: Enter either:
- The full path to the executable that will sort the CSV file.
- A valid Windows command line instruction to sort the records.
This instruction should do the following:- Do some processing of the input CSV file which PlanetPress Connect will pass through in the position of the ${input} placeholder.
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
cmd /C sort /R ${input} ${output}
This would reverse the order of the${input}
file, and sent the output to the${output}
file.
- 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.