The DBGET function returns the contents of a field in a database.
database is the name of a database and must include the full path if not in the same directory as the open document.
source is the name of the database object, which can be a table, query, relation or SQL statement.
field_name is optional and can be either the name of the field within a table or relation or the column number. If omitted, every row and column of the filtered table is returned.
rec_num is optional (and cannot be specified if field_name is omitted) and determines the record or row number of the returned value. If omitted, the entire column is returned (or table if field_name is also omitted).
The function arguments are case insensitive.
For example, a database called wineshop, located in a folder c:\ability\samples, contains a table called Products, which details a list of wines. The table contains three fields as follows:
Title |
Price |
Classification |
Château Haut du Puy |
17.00 |
red |
Volnay-Santenots |
27.00 |
red |
Le Chambertin |
53.00 |
red |
Chambolle-Musigny |
28.50 |
red |
DBGET can be used in the following ways:
DBGET("c:\ability\samples\wineshop.adb", "products", 1, 1)
returns "Château Haut du Puy", the first field from the first record.
DBGET("c:\ability\samples\wineshop.adb", "products", "price", 3)
returns 53.00, the Price field from record three.
SUM(DBGET("c:\ability\samples\wineshop.adb", "products", "price"))
returns 125.50, the sum of the Price field.
See also: