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.
The name of an index.
An explicit value or the name of a field in the table containing a value.
An expression based on numeric or exponent numeric field(s) in the Lookup_Table.
Returns the average value for a field in records of a specified table.
DBAVG() searches the specified Lookup_Table for one or more records with the specified Key_Value, and returns the average value of the values contained in Lookup_Expression. Note : If no records with matching key values are found, Alpha Anywhere returns a zero value.
Assume that a customer order table (ORDER) contains the following records:
To determine the average of the values in the AMOUNT field for all the records in the ORDER table with a customer ID number of "C100", use the following expression:
dbavg("ORDER.DBF", "CUSTOMER_ID", "C100", "AMOUNT") -> 152.78
Assume that the CUST_ID field in the current record contains "C102". The following expression returns the average of the values in the AMOUNT field for all the records in the ORDER table with a customer ID number of "C102":
? dbavg("ORDER.DBF", "CUSTOMER_ID", CUSTOMER_ID, "AMOUNT") = 549.18
This example is based on the invoice_items table of the AlphaSports database.
dim pnum as C = "P001" ? dbavg("invoice_items", "Product_ID", pnum, "Quantity") = 3.6