# Selection criteria

Selection criteria determines which items are to be processed by AQL and is designated
 by the with or if modifiers. Without any selection clauses in an AQL sentence, every item in the
 file is eligible for processing.

Note:
 Due to interface optimization, the FSI eliminates some records before passing them back to
 VME.

 For example:

```
Select file if date > "30 Oct 2017" and if date < "1 Jan 2019"
```

 could return

```
[401] 10 items selected out of 10 items.
```

 when there are actually hundreds of items in the file.

 Compound selection clauses are formed with relational operators. When two clauses are
 connected by an and, both conditions must evaluate to true for an item to be
 selected for processing. When two selection clauses are connected with an or,
 or no relational operator is specified between selection clauses, either condition may evaluate
 to true for the item to be selected for processing.

 The value specified in the *valuestring* clause must match exactly with the
 stored value for selection to occur. For example:

```
list entity with city = "irv" city
```

 Only those items that contain `irv` in the city attribute are eligible for
 processing.

 Selection criteria limits the data that must be met. Multiple criteria may be established to
 limit data selection to meeting a certain set of limitations. These sets are established by the
 logical relational connectives.

 An active list can be used by another select sentence to narrow down the
 resulting list. A list can be passed to another list until a save-list or any
 other AQL, TCL, or FlashBASIC command is invoked. For example:

```
select entity with state = "ny"
n items selected.

select entity with city = "syracuse"
m items selected.

list entity name city state phone
```

 The previous series of sentences first selects all entity items in the state of New York
 (`ny`), then out of these selects all entity items in the city of
 `Syracuse`, and then outputs a columnar report of `name`
 `city`
 `state` and `phone`.

## Pre-processor

The AQL pre-processor is an enhancement to the Access query language used on D3. The
 pre-processor provides two major functions:

- Adds the ability to use and define phrases that contain parts of AQL sentences.

- Eliminates the requirement that explicit values be enclosed in quotation marks, except to resolve ambiguities.

 The AQL pre-processor is enabled by changing the command definition in the master dictionary
 for any AQL commands pre-processing is desired. The pre-processor scans the
 input sentence, expands phrases and determines which words are values, then
 passes the sentence to the standard AQL compiler. In normal operation, the AQL pre-processor
 processes the input statement before the AQL compiler.

## See also

- [Access Query Language](https://d3codex.com/access/access-query-language/)
- [after operator](https://d3codex.com/access/after-operator/)
- [and clause](https://d3codex.com/access/and-clause/)
- [before operator](https://d3codex.com/access/before-operator/)
- [AQL command categories](https://d3codex.com/access/aql-command-categories/)
- [count command](https://d3codex.com/access/count-command/)
- [ge operator](https://d3codex.com/access/ge-operator/)
- [Item list](https://d3codex.com/access/item-list/)
- [ld command](https://d3codex.com/tcl/ld-command/)
- [le operator](https://d3codex.com/access/le-operator/)
- [list command](https://d3codex.com/access/list-command/)
- [list-item command (Access Query Language)](https://d3codex.com/access/list-item-command-access-query-language/)
- [list-label command](https://d3codex.com/access/list-label-command/)
- [not operator](https://d3codex.com/access/not-operator/)
- [nselect command](https://d3codex.com/access/nselect-command/)
- [Phrases](https://d3codex.com/access/phrases/)
- [s-dump command](https://d3codex.com/tcl/s-dump-command/)
- [select command](https://d3codex.com/access/select-command/)
- [Selection processor](https://d3codex.com/definitions/selection-processor/)
- [sort command](https://d3codex.com/access/sort-command/)
- [sort-label command](https://d3codex.com/access/sort-label-command/)
- [sortc command](https://d3codex.com/tcl/sortc-command/)
- [sreformat command](https://d3codex.com/access/sreformat-command/)
- [sselect command](https://d3codex.com/access/sselect-command/)
- [istat command](https://d3codex.com/access/istat-command/)
- [check-sum command](https://d3codex.com/access/check-sum-command/)
- [t-dump command](https://d3codex.com/tcl/t-dump-command/)
- [t-load command](https://d3codex.com/tcl/t-load-command/)
- [with modifier](https://d3codex.com/access/with-modifier/)
- [without modifier](https://d3codex.com/access/without-modifier/)

---
Source: https://d3codex.com/access/selection-criteria/ - part of the D3Codex reference.
