Database Variant

Syntax

DETERMINE ACTUAL <variant> [ GS status ]
     <logic_block>
END | ENDEXIT | ENDNOPRINT
<variant> := <databaseVariant> | <extractFileVariant> | <sqlVariant>
<databaseVariant> := <iterator> [ SERIAL ] [ SECURE | KEYONLY ] [ MULTI records ]
<iterator> := <object> | <profile>
<object> := object_name( argument [ ,...n] )
<profile> := object_name.profilename( argument [ ,...n] )

Parameters

Note: The Serial, Secure, KeyOnly, and Multi records parameters are not applicable to external classes with persistent members.

Description

The database variant of the Determine Actual logic command reads persistent class records into memory from the database, with or without using a profile. You can use an external class with persistent members to read records from an external database by using a profile.

Examples

Example 1

This example illustrates code from a report that reads records from the product table by using a profile called P_ProductName, retrieving the records in order based on the product name. The ProductID and ProductName are moved from each retrieved record into a ProductDetail frame and printed.

Determine Actual Product.P_ProductName 
      ProductDetail.ProductID    := Product.ProductID  
      ProductDetail.ProductName := Product.ProductName
      ProductDetail.Print()
End
If (GLB.STATUS = "*****")
      Message Attention "No Product records found"
End

For this example, output from the report is as follows, in product name order:

Product ID

Product Name

7

CatBathSoap

2

Chips for cats

6

DogBelt

3

Gimborn R-7

4

KittenCaps

9

Leather Belt

1

Outfit for Dogs

8

PetOutfit

5

Toys for Cats

10

ToyPet

Example 2

This example illustrates report logic that retrieves data from the product table in the order of the records that reside in the table. The ProductID and ProductName are moved from each retrieved record into a ProductDetail frame and printed.

Determine Actual Product 
      ProductDetail.ProductID    := Product.ProductID  
      ProductDetail.ProductName := Product.ProductName
      ProductDetail.Print()
End
If (GLB.STATUS = "*****")
     Message Attention "No Product records found"
End

For this example, output from the report is as follows, in the order of the records in the product table:

Product ID

Product Name

1

Outfit for Dogs

2

Chips for cats

3

Gimborn R-7

4

KittenCaps

5

Toys for Cats

6

DogBelt

7

CatBathSoap

8

PetOutfit

9

Leather Belt

10

ToyPet

Example 3

Using this form of the Determine Actual command, records containing information about new products are read from a text file. The retrieved data is then used to write new records into the product table.

ProductWriteFile.Open("New_Products.txt”,ProductWriteFile.ReadMode)
Determine Actual ProductWriteFile
      Product.ProductID     :=  ProductWriteFile.Details.ProductID
      Product.ProductName   :=  ProductWriteFile.Details.ProductName
      Product.UnitPrice     :=  ProductWriteFile.Details.UnitPrice
      Product.Store()
End
If (GLB.STATUS = "*****")
     Message Attention "No new product records found"
End