Click or drag to resize

DbServer.GetLookupTable Method

Retrieve a two-column array of values from two fields in the server, subject to the currently active selection, if any.

Namespace:  VO
Assembly:  VORDDClasses (in VORDDClasses.dll) Version: 2.5
Syntax
 VIRTUAL METHOD GetLookupTable(
	nMaxRows AS USUAL,
	uField1 AS USUAL,
	uField2 AS USUAL,
	uSearchValue AS USUAL
) AS USUAL

Parameters

nMaxRows
Type: Usual
The maximum number of rows that should be retrieved.  If omitted, 100 rows at most are retrieved.
uField1
Type: Usual
The name, number, or symbol of the first field to be retrieved.  If omitted, the first field is retrieved.
uField2
Type: Usual
The name, number, or symbol of the second field to be retrieved.  If omitted, the second field is retrieved.
uSearchValue
Type: Usual
The value to be searched for, under the currently controlling order.  The system performs a Seek() operation, and then proceeds to load up the array from there.

Return Value

Type: Usual
The method returns a two-column array of values found for the specified fields, moving sequentially until the specified maximum number of rows or until end of file.  If a selection is active, the method includes only records from that selection.  The values are retrieved under the current controlling order, if any. Note that the method does not reposition to the beginning before starting to fill the array.  Either provide a start value, or explicitly position the server before using the method.  (This allows incremental reading, building up an array in pieces.)
Remarks
Sends a NotifyIntentToMove message before the operation.  Sends a NotifyRecordChange message upon completion, and leaves the server positioned at the last record used or at end of file (last file record).  One use of this method is to populate translation lists in user interfacing.  The resulting array can be used in ATranslate().
Examples
The following builds a lookup table, for example to translate product codes into product names and vice versa, beginning at the indicated product number:
X#
1oDB := DBServer{"products",#Shared,#ReadOnly}
2oDB:SetIndex("prodno")
3aProducts := oDB:GetLookupTable(500,#ProdNo,#ProdName, 22750)
4oDB:Close()
See Also