FILTER |
Filter is used to select the records from a table previously opened and to specify a scan key.
Filter class [ Where_exp [ Order_by_exp ]
|
Element |
Description |
Restrictions |
|
class |
Abbreviation of an open file |
the file must already be open |
|
Where_exp |
expression_de_sélection See Where |
None. |
|
Order_by_exp |
expression_de_clé See Order |
None. |
# Editing client commands between 2 datesFilter [CCL] Where DATCCL >= DATDEB and DATCCL <= DATFIN
For [CCL]CLICCL(1) For [CCL]CLICLL(2) ... Next Next # In the client command file, a command has been processed# and the next can be read – if there is one.
Filter [CCL] Where CODCLIF = [L]CLICUR and NUMCCL > [L]NUMCUR
Raz [L]OK For [CCL] [L]OK = 1 : Break Next If [L]OK # there is another command for this clientElse
# no other commandEndif
# Cancellation of records according to a particular criterionFilter [ABR] Where evalue([L]CRITERE)
Delete [ABR]CLE(1) >= "" : # CLE(1) being alphanumericFilter [ABR] : # cancels the selection
Filter in association with the Where clause is used to select records from a table previously opened. This speeds up access to the data in this table.
The access key may also be changed, using the Order By clause as well. This new key may be either an existing key or a new one defined in the Order By clause.
If the table was opened with a Where clause, Filter reinforces the selection by using a "logic and" with the condition expressed when the table was opened. The File and Link commands may be used for this open operation. The same applies within a For …Next loop.
If one Filter instruction follows another Filter, it cancels and replaces the first. Use will therefore be made of the Filter [abv] instruction without another argument to cancel any other filter.
There is a locality level attached to the files opened by Local File. Conversely, there is none attached to the Filter command. Thus, if this command appears in a sub-programme on a previously opened table (and – of course – not re-opened in the sub-programme), it will still be active on returning to the calling routine.
After Filter, the variable [G]currind is always 1.
In terms of performance, the selection may be made on opening the table, or by Filter. This latter syntax gives more flexibility to writing routines since it can be changed or cancelled at any time.
General restrictions relating to Where and Order By clauses apply in full when they are used with Filter.
|
Error |
Description |
|
ERCLAS ( 7) |
Abbreviation not found |
WHERE -ORDER - FILE - FOR - TRBEGIN - LINK - READ - DELETE - UPDATE - CURRIND
CONTENTS
|
|