# sort-label command

The sort-label command produces one
or more columns of output in order of the specified sort-key. The sort-label command outputs formatted labels or reports
in columnar format from the specified file reference, sequenced by
one or more sort-key.

## Syntax

```
sort-label file.reference {item.list} {selection.criteria}
{sort.criteria} {output.specification} {modifiers} {(options)}
```

## Description

After pressing ENTER to submit
the AQL sentence for processing, a `?` prompt displays.
This prompt supplies the label output parameters:

| columns | Number of labels across page. |
| --- | --- |
| rows | Number of print lines on each label. |
| skip | Number of lines (vertically) between labels. |
| indent | Number of spaces to indent from left the margin. |
| size | Number of print positions per label. |
| space | Number of spaces (horizontally) between labels. |
| c | Compresses null values. |
Each parameter must be separated by a comma. If the *indent* parameter is not zero, this command prompts for
entry of the header text for each print line requested. If any text
is entered at any of these prompts, that text displays before the
corresponding print line on the leftmost (1st) column only. Pressing
ENTER at any of these prompts indicates a null header.

Tip: If problems exist with the formatting of the sort-label output, try using the tcl-hdr-off command first and a k option with the sort-label command.

## Example(s)

The label parameters shown define
the output as having 2 labels across, 4 lines each (`contact`, `company`, `address`, and `csz`), skip 1 line, indent 0 (zero - assumes labels are mounted
at first print position), 30 print positions each (longer strings
are truncated to 30, in this case), space over 2 to the right between
each label, and `c` for *compress* nulls (do not
allow blank lines within the label).

```
: sort-label entity by zip contact company address csz (cip
? 2,4,1,0,30,2,c
```

## See also

- [AQL command categories](https://d3codex.com/access/aql-command-categories/)
- [Item list](https://d3codex.com/access/item-list/)
- [list-label command](https://d3codex.com/access/list-label-command/)
- [Modifiers](https://d3codex.com/access/modifiers/)
- [Options (Access Query Language)](https://d3codex.com/access/options-access-query-language/)
- [Selection criteria](https://d3codex.com/access/selection-criteria/)
- [sortc command](https://d3codex.com/tcl/sortc-command/)
- [term command](https://d3codex.com/tcl/term-command/)

---
Source: https://d3codex.com/access/sort-label-command/ - part of the D3Codex reference.
