LookUp From

Syntax

LOOKUP FROM expression class_name [ SERIAL ] 
[ SECURE | KEYONLY ] [ MULTI expression ]
[ GS status ]

Parameters

LookUp From can be abbreviated as LU From.

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