ubase.lookupRecord

Syntax ubase.lookupRecord (fnum, key, adrTable)

Params fnum is the number which identifies a uBASE database while it is open

key is the key identifying a record

adrTable is the address in the Frontier database of a table into which the results of this verb will be stored (see Notes)

Action Obtains the contents of the record identified by key in the database indicated by fnum. Places each field into an element of the table at adrTable (see Notes).

Returns True if the record was found, false if the record was not present in the database.

Examples local (rec)
if ubase.lookupRecord (statesFnum, "California", @rec)
» msg ("The capital of California is " + rec.capi)

else
» msg ("uBASE reported the error " + rec.errs)

This example assumes that the "States Database" produced by a shared menu item in uBASE as shipped is open with the identifier statesFnum.

Errors An error is produced if uBASE is not running.

Platform Notes uBASE runs only on Mac OS and is not a supported component of Frontier 5.0,

Notes The behavior of this verb changed starting with uBASE 1.0a5. Most old scripts should run unchanged.

ubase.lookupRecord creates a new table at the address you provide [new in 1.0a5].

If uBASE causes an entry named 'errs' to be placed into the table, this verb returns false to indicate the error. You can look at the errs entry to see what the error was (it is a string). The record might be missing, or the fnum parameter may not

specify an open database.

Prior to uBASE 1.0a5, you needed to check the table produced by this verb for the presence of an entry named errs to detect errors. Scripts which do that will still run...new scripts should be written to test the boolean returned by this verb.

If you are looking up a record to extract the value of just one field, consider using ubase.getField instead of this verb.

See Also ubase.getField

Discuss