Click or drag to resize

SQLSelect.GetLookupTable Method

X#
Retrieve a two-column array of values from two fields in the server.

Namespace:  VO
Assembly:  VOSQLClasses (in VOSQLClasses.dll) Version: 2.21
Syntax
 VIRTUAL METHOD GetLookupTable(
	nMaxRows,
	uField1,
	uField2
) AS USUAL CLIPPER
Request Example View Source

Parameters

nMaxRows (Optional)
Type: Usual
The maximum number of rows that should be retrieved. If omitted, the default is 100. The name, number, or symbol of the first field to be retrieved. If omitted, the first field is retrieved. The name, number, or symbol of the second field to be retrieved. If omitted, the second field is retrieved.
uField1 (Optional)
Type: Usual
uField2 (Optional)
Type: Usual

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. 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 NotifyRecordChange message afterwards, 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#
1oSQLSelect := SQLSelect{"SELECT * FROM products WHERE ProdNo > 100"}
2aProducts := SQLSelect:GetLookupTable(500,#ProdNo, #ProdName)
3oSQLSelect:Close()
See Also