Syntax
LOOKUP FROM expression class_name [ SERIAL ] [ SECURE | KEYONLY ] [ MULTI expression ] [ GS status ]
Parameters
LookUp From can be abbreviated as LU From.
expression
The primary key value to start reading from.
This variable must share the same primitive as the primary key.
class_name
The persistent class to read.
SERIAL
Increases efficiency by retaining pointers. Refer to Serial for more information.
SECURE
Facilitates record locking of the database in applications that do not force integrity. Refer to Secure for more information.
KEYONLY
The KeyOnly command option is not supported on applications that are deployed to Windows.
For MCP-based systems, refer to KeyOnly.
MULTI expression
The Multi command option is not supported on applications that are deployed to Windows or MCP.
GS status
Indicates if there are no records retrieved, using the specified qualifier.
Description
The LookUp From logic command reads persistent class records into memory from the database, starting from the specified primary key.
Records are read in ascending primary key order. The record retrieval loop iterates until end-of-file, or an explicit exit (for example, a Break or JumpTo logic command).
Refer to LookUp Variants for more information on the LookUp logic command.
Example
This example illustrates code from a report that makes use of the Lookup From command to read records from the product table, starting from the specified ProductID. The ProductID and ProductName are moved from each retrieved record into a ProductDetail frame and printed.
Message Attention “Please enter the starting product id” Accept Start_id Lookup From Start_id Product ProductDetail.ProductID := Product.ProductID ProductDetail.ProductName := Product.ProductName ProductDetail.Print() End If (GLB.STATUS = "*****") Message Attention "No Product records found from starting ID" End
For this example, if the input is provided as Start_id = “6”, then the output is as follows. The output displays the product details of the products, starting from the specified value which is “6”. If there had been no product whose Product ID was “6”, Lookup From would have looked forward for the next record to retrieve.
Product ID |
Product Name |
---|---|
6 |
DogBelt |
7 |
CatBathSoap |
8 |
PetOutfit |
9 |
Leather Belt |
10 | ToyPet |