TABLEMAX Function

Syntax

Largest_Of_Values as A = TABLEMAX(C tablename,C filter,C field)

Arguments

tablename

The full drive, path, name, and extension of the table. If you omit the drive, path, and extension, Alpha Anywhere searches the directory of the current table.

filter

A character filter expression that evaluates to a logical value. Selects records to examine.

field

An expression based on character, numeric, date, or exponent numeric field(s) in the Lookup_Table.

Description

Returns the maximum value of matching records in a specified table.

Discussion

Searches the specified Lookup_Table for one or more records that satisfy the specified Filter, and returns the largest of the values contained in the Lookup_Expression. The Filter must return a logical value, either True (.T.) or False (.F.). For example, to choose all of the records in a table, use the logical constant ".T." as a filter. To choose only the records where the STATE field is equal to TN, use the filter "STATE = 'TN'". Note that the entire filter is always in quotations, and the character value, TN, is in single quotes. Note : If no records satisfy the filter, Alpha Anywhere returns a zero value.

Assume that a department purchasing table ( PURCHASE ) contains the following records:

PURCHASE
>
MANAGER
COST
ANDRY

18500.00

BROWN

49.95

BROWN

12.99

FARLEY

7995.00

FARLEY

142.16

FARLEY

423.00

The following expression returns the largest of the values in the COST field for all the records in the PURCHASE table:

tablemax("PURCHASE.DBF", ".T.", "COST") -> 18500.00

Note : See TABLECOUNT()for more expression formatting examples.

See Also