You can sort text and data in a current document or in a file on disk to organize information in a variety of ways.
In this section, you'll learn about
sorting
working with records
working with sort keys
creating and modifying sort definitions
You can use sort operators to define the expression for a sort. For information about sort operators, see "Sort operators."
Sorting
You can sort text by using the predefined sort definitions included in WordPerfect. The sorted text can be displayed on-screen or saved to a file.
By using sort definitions, you can sort text alphabetically or numerically. For example, you can alphabetize a word list, sort a table of students according to their grades, or create a chronological list of purchase dates. You can also set sort options to be able to undo a sort or to sort uppercase words before lowercase words.
You can sort by date. You can also sort items in reverse order so that the last displays first.
To sort text
1 Click Tools Sort.
2 Click File to sort, and click a file.
3 Click Output to, and click a file.
4 From the Sort by list, choose one of the following:
First word in a paragraph-where each paragraph record ends with two or more hard returns
First word in a merge data fiIe-where each merge record ends with an ENDRECORD code
First cell in a table row-where each record is a row of cells
First word in a parallel column-where each record is a table column or parallel column
First word in a line-where each line record ends with a hard return
Date in a line-where each record ends with a hard return
Date in a table row-where each record is a row of cells
Tip
You can sort only part of a document by selecting the text you want to sort.
To sort text alphabetically or numerically
1 Click Tools Sort.
2 Click File to sort, and click a file.
3 Click Output to, and click a file.
4 Click New.
5 In the New sort dialog box, type a name in the Sort description box.
6 In the Sort by area, enable one of the following options:
Line (ends with one hard return)-sorts by line
Paragraph (ends with multiple hard returns)-sorts by paragraph
Merge record-sorts by merge record
Table row-sorts by table row
Parallel column row-sorts by table column or parallel column
Date-sorts by date
7 In the Keys (sorting rules) area, choose one of the following from the Type list box:
Alpha
Numeric
8 Choose one of the following from the Sort order list box:
Ascending-sorts from first to last or smallest to largest
Descending-sorts from last to first or largest to smallest
Tip
You can sort only part of a document by selecting the text you want to sort.
To set sort options
1 Click Tools Sort.
2 Click Options, and click one of the following:
Allow undo after sorting
Uppercase sorts before lowercase.
A check mark next to the command indicates that the command is enabled.
To sort dates
1 Click Tools Sort.
2 Click File to sort, and click a file.
3 Click Output to, and click where you want to output the sorted text.
4 Click New.
5 In the New sort dialog box, type a name in the Sort description box.
6 In the Sort by area, enable the Line (ends with one hard return) option.
7 In the Keys (sorting rules) area, choose Date from the Type list box.
8 Choose one of the following from the Sort order list box:
Ascending-sorts from smallest to largest or first to last (1 to 9)
Descending-sorts from largest to smallest or last to first (9 to 1)
Notes
You must define a sort key for each part of the date you want to sort. For information about defining a sort key, see "Working with sort keys."
When you enter a date, use forward slashes ( / ) or dashes ( - ) to separate the numbers in a date (for example, 12/25/59). WordPerfect interprets the date 12/25/59 as one word.
To sort by the last item in a list
1 Click Tools Sort.
2 Do any of the following:
Click File to sort and choose a file.
Click Output to and choose where you want to output the sorted text.
3 Click New.
4 In the New sort dialog box, type a name in the Sort description box.
5 In the Sort by area, enable one of the following options:
Line (ends with one hard return)-sorts by line
Paragraph (ends with multiple hard returns)-sorts by paragraph
Merge record-sorts by merge record
Table row-sorts by table row
Parallel column row-sorts by table column or parallel column
Date-sorts by date
6 In the Keys (sorting rules) area, choose one of the following from the Type list box:
Alpha-sorts in alphanumeric order by letters and then by numbers
Numeric-sorts by numbers only
Date-sorts by date
7 In the Keys (sorting rules) area, choose one of the following from the Sort order list box:
Ascending-sorts from smallest to largest order or first to last (1 to 9)
Descending-sorts from largest to smallest order or last to first (9 to 1)
8 In the Keys (sorting rules) area, tab to the record subdivision boxes and type a value in one of the following boxes that corresponds to the part of the record you want to sort:
Line
Field
Word
Column
Working with records
You can sort records that meet certain criteria by using sort operators and sort keys. Sorting this way limits a sort to only the information you want.
When you combine sort operators and parameters, you create expressions (selection statements). For example, specifying "Smith" and "Nevada" lets you select only records that contain both words. For more information about using sort operators, see "Sort operators."
Each record contains the same categories of information, such as names with addresses, items in inventory, or client data. Text is divided into records, and records are subdivided into lines, words, fields, or columns depending on the text format. The subdivisions can be used to set criteria for the sort. The way records are divided depends on how the record is formatted, for example, in a table or in paragraphs.
You can also extract records without sorting them. Extracting records allows you to collect the data you need and leave them in their original order.
To extract records without sorting
1 Click Tools Sort.
2 Click File to sort and choose a file.
3 Click New.
4 In the New sort dialog box, type a name in the Sort description box.
5 In the Keys (sorting rules) area, tab to the record subdivision boxes and type a value in one of the following boxes that corresponds to the part of the record you want to sort:
Line
Field
Word
Column
If you want to define other sort criteria, type an expression in the Extract records box.
6 Enable the Extract records without sorting check box.
To specify sort criteria
1 Click Tools Sort.
2 Click New.
3 In the New sort dialog box, type a name in the Sort description box.
4 In the Sort by area, enable one of the following options:
Line (ends with one hard return)-sorts by line
Paragraph (ends with multiple hard returns)-sorts by paragraph
Merge record-sorts by merge record
Table row-sorts by table row
Parallel column row-sorts by table column or parallel column
Date-sorts by date
5 In the Keys (sorting rules) area, choose one of the following from the Type list box:
Alpha-sorts in alphanumeric order by letter and then by number
Numeric-sorts by number only
Date-sorts by date
6 Choose one of the following from the Sort order list box:
Ascending-sorts from smallest to largest or first to last
Descending-sorts from largest to smallest or last to first
7 Tab to the record subdivision boxes and type a value in any of the following boxes:
Line
Field
Word
Column
If you want to further define a sort, type selection statements in the Extract records box.
Notes
When you extract records, the original file remains unchanged; the output file contains only the records you specified.
Key 1 is sorted first, Key 2 is sorted next, and so on.
Tips
You can also use parentheses to group parts of a selection statement.
You can sort only part of a document by selecting the text you want to sort.
Working with sort keys
You can add a sort key (or rule) to define how you want information sorted. You define the sort keys, and use them to specify which part of the record to sort and the order of the sort. The sort keys are applied in numerical order.
You can also edit a sort key definition, and delete a sort key.
To add a sort key
1 Click Tools Sort.
2 Choose a sort definition from the Sort by list box.
3 Click Edit.
4 In the Keys (sorting rules) area, click a key.
5 In the Keys (sorting rules) area, click one of the following:
Add Key at end-adds a key to the end of the key list
Insert Key between-adds a key above the row in which the cursor is positioned
Note
You can add up to nine sort keys.
To edit a sort key definition
1 Click Tools Sort.
2 From the Sort by list box, choose a sort definition.
3 Click Edit.
4 In the Keys (sorting rules) area, click a key.
5 Modify any settings.
6 In the Keys (sorting rules) area, choose one of the following from the Type list box:
Alpha-sorts in alphanumeric order by letters and then by numbers
Numeric-sorts by numbers only
Date-sorts by date
7 In the Keys (sorting rules) area, choose one of the following from the Sort order list box:
Ascending-sorts from smallest to largest order or first to last (1 to 9)
Descending-sorts from largest to smallest order or last to first (9 to 1)
8 In the Keys (sorting rules) area, tab to the record subdivision boxes and type a value in one of the following boxes that corresponds to the part of the record you want to sort:
Line
Field
Word
To delete a sort key
1 Click Tools Sort.
2 From the Sort by list box, choose a sort definition.
3 Click Edit.
4 Click a key.
5 Click Delete key.
Creating and modifying sort definitions
You can create a new sort definition, and you can edit, copy, or delete an existing sort definition.
When you define sort keys you are creating a sort definition. Sort keys (or rules) can define how you want information sorted. Sort keys determine which part of the record to sort and the order of the sort. The sort keys are applied in numerical order.
To create a sort definition
1 Click Tools Sort.
2 Click New.
3 In the Sort description box type a name.
4 In the Sort by area, enable one of the following options:
Line (ends with one hard return)-sorts by line
Paragraph (ends with multiple hard returns)-sorts by paragraph
Merge record-sorts by merge record
Table row-sorts by table row
Parallel column row-sorts by table column or parallel column
Date-sorts by date
5 In the Keys (sorting rules) area, choose one of the following from the Type list box:
Alpha-sorts in alphanumeric order by letters and then by numbers
Numeric-sorts by numbers only
Date-sorts by date
6 In the Keys (sorting rules) area, choose one of the following from the Sort order list box:
Ascending-sorts from smallest to largest order or first to last (1 to 9)
Descending-sorts from largest to smallest order or last to first (9 to 1)
7 In the Keys (sorting rules) area, tab to the record subdivision boxes and type a value in one of the following boxes that corresponds to the part of the record you want to sort:
Line
Field
Word
Column
Notes
When you create a new sort definition, it is saved in the Sort by list box.
You can customize a sort by using sort keys. For information about sort keys, see "Working with sort keys."
To edit a sort definition
1 Click Tools Sort.
2 From the Sort by list box, choose a sort definition.
3 Click Edit.
4 In the Sort description box, type a new name.
5 Modify any settings.
6 In the Sort by area, enable one of the following options:
Line (ends with one hard return)-sorts by line
Paragraph (ends with multiple hard returns)-sorts by paragraph
Merge record-sorts by merge record
Table row-sorts by table row
Parallel column row-sorts by table column or parallel column
Date-sorts by date
7 In the Keys (sorting rules) area, choose one of the following from the Type list box:
Alpha-sorts in alphanumeric order by letters and then by numbers
Numeric-sorts by numbers only
Date-sorts by date
8 In the Keys (sorting rules) area, choose one of the following from the Sort order list box:
Ascending-sorts from smallest to largest order or first to last (1 to 9)
Descending-sorts from largest to smallest order or last to first (9 to 1)
9 In the Keys (sorting rules) area, tab to the record subdivision boxes and type a value in one of the following boxes that corresponds to the part of the record you want to sort:
Line
Field
Word
To copy a sort definition
1 Click Tools Sort.
2 From the Sort by list box, choose a sort definition.
3 Click Copy.
4 In the Sort description box, type a new name.
To delete a sort definition
1 Click Tools Sort.
2 From the Sort by list box, choose a sort definition.
3 Click Delete.
Reference: Sorting text and data
A sort operator is a symbol that instructs the soft to perform an action in an expression (selection statement). For example, the expression, key1=red & key3>5, extracts only the records where the information in the first sort key is red and the information in the third sort key is greater than five. When you define a sort definition, you can use sort operators.
Sort operators
When you define the criteria for a sort definition, you can use the sort operators listed in the following table.
Symbol What It Does
| Selects records that meet the conditions of either key.
& Selects records that meet the conditions of both keys.
= Selects records that have the same information in an indicated key.
<> Selects records that do not match the information for an indicated key.
> Selects records that have information greater than the information for an indicated key.
< Selects records that have information less than the information for an indicated key.
>= Selects records that have information greater than or equal to the information for an indicated key.
<= Selects records that have information less than or equal to the information for an indicated key.
key g Selects records that contain the word you specify anywhere in the record (global search).
Notes
Each line of text is a field that can be divided into two or more fields using tabs and indents.
In merge records, fields end with the ENDFIELD code.