COUNT command

Used to count the total number of records in the current view, or only those records that meet the specified test conditions.

Syntax

COUNT <IF test> <WHILE test> <{FIRST|NEXT} range>

Parameters

IF test

Optional. Specifies a condition that must be met. The command is only executed on records that pass the test.

WHILE test

Optional. Specifies that the command should only be executed while a condition is true. The command processing terminates as soon as the specified test evaluates as false, or the end of the table is reached.

FIRST | NEXT range

Optional. Specify FIRST to start processing at the first record or NEXT to start processing at the currently selected record. Use the range value to specify the number of records to process.

ACL output variables

COUNTn

Stores the record count calculated by the command.

If the variable name is COUNT1, it is storing the record count for the most recent command executed.

If the variable name is COUNTn where n is greater than 1 the variable is storing the record count for a command executed within a GROUP command. The value of n is assigned based on the line number of the command in the GROUP. For example, if the command is one line below the GROUP command it is assigned the value COUNT2. If the command is four lines below the GROUP command, it is assigned the value COUNT5.

Remarks

You can use the COUNT command to count the number of records in an ACL table, or to count the number of records that meet a particular test condition. If no test is specified, the total number of records in the ACL table is displayed. If a filter has been applied to a view, the command counts the number of records remaining in the view after the filtering condition has been applied.

Example

The following example illustrates how the result of the COUNT command is stored by ACL in the COUNT1 variable, and can be retrieved and stored in a user-defined variable. The COUNT command overwrites the COUNT1 variable each time it is executed, so the value needs to be stored in a user-defined variable before the command is executed for the second time after the filter applied to the table.

OPEN CustomerAddress
COUNT
TotalRec = COUNT1
SET FILTER TO ModifiedDate > ‘20100101‘
COUNT
TotalFilteredRec = COUNT1


(C) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback