xHarbour Reference Documentation > Operator Reference |
Alias operator (binary): identifies a work area.
<aliasName> -> <fieldName> (<nWorkArea>) -> <fieldName> <aliasName> -> ( <expr,...> ) (<nWorkArea>) -> ( <expr,...> ) FIELD -> <fieldName> MEMVAR -> <varName>
The alias operator "points" to an unselected work area identified with its symbolic name <aliasName> or its ordinal number <nWorkArea>. This allows for retrieving values of field variables from unselected work areas or executing expressions in the specified work area. The alias operator implicitly selects the work area specified with the left operand and then executes the instructions of the right operand. When the operation is complete, the original work area becomes current again.
FIELD and MEMVAR are reserved alias names that allow for resolving name conflicts between memory and field variables. If memory and field variables with the same symbolic name exist, unaliased variables are resolved as field variables. This behaviour is influenced by the compiler switch /v. It is, however, strongly recommended to avoid identical variable names for memory and field vraiables, and to use the alias operator to identify a variable unambiguously.
See also: | DbSelectArea(), FIELD, FieldName(), FieldPos(), FieldGet(), MEMVAR, Select(), USE |
Category: | Special operators , Operators |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates usage of the alias operator. // The last aliased expression generates a runtime error. PROCEDURE Main LOCAL nArea USE Customer ALIAS Cust // current work area ? FIELD->Lastname // result: Miller nArea := Select() // work area number SELECT 100 // select free work area ? Used() // result: .F. ? Cust->Lastname // result: Miller ? Cust->(Recno()) // result: 1 ? (nArea)->Lastname // result: Miller ? (nArea)->(LastRec()) // result: 1576 ? FIELD->Lastname // runtime error USE RETURN
http://www.xHarbour.com