Determine Group

Syntax

DETERMINE GROUP <iterator> { FROM | BACK } ( [ argument [ ,...n ] ] ) [ UNTIL 
(argument [ ,...n ] ) ] 
[ SERIAL ] [ SECURE | KEYONLY ] [ MULTI records ] [ GS status ]
		<logic_block> 
END | ENDEXIT | ENDNOPRINT  ] 
<iterator> := <object> | <profile>
<object> := object_name
<profile> := object_name.profile_name( argument [ ,...n ] )  

Parameters

Determine Group can be abbreviated as DT Group.

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

Description

The Determine Group logic command reads persistent class records into memory from the database by using a profile, between specified start and end key values. The data read from the database is stored in the instance of the persistent class specified in the command. You can also use an external class with persistent members to read records from an external data source. It can be used to specify

If the Until command option is not specified, the loop terminates when the last record with the specified high-order values is retrieved (or the last record in the file, if high-order values are not specified).

Refer to Determine Variants for more information on the Determine logic command.

Restrictions

The following restrictions apply to use of the Determine Group logic command:

Example

In this example, for each product, the report lists the ProductID and ProductName, and then lists details of every sale that has occurred for that product. The Determine Group command is used to retrieve every SaleEvent transaction for the ProductID specified, moving the details into the SaleDetail frame and printing. 

Since the P_DateTime profile has four keys, corresponding data must be provided for the Determine Group command to use. Product.ProductID is provided, corresponding to the first key of the profile, and designating exactly what SaleEvent records need to be retrieved – low values (since the keys of this profile are in ascending order) are provided to correspond to the secondary keys.

 Determine Actual Product.P_ProductName 
    ProductDetail.ProductID    := Product.ProductID  
    ProductDetail.ProductName := Product.ProductName
    ProductDetail.Print()
    Determine Group SaleEvent.P_DateTime (Product.ProductID) From \
                               (Glb.zeros, Glb.Spaces, Glb.Zeros)
         SaleDetail.CustomerID := SaleEvent.CustomerID
         SaleDetail.Quantity    := SaleEvent.SoldQuantity
         SaleDetail.Print()

   
   End
   If (GLB.STATUS = "*****")
        SaleDetail.CustomerID := “NONE”
        SaleDetail.Quantity    := 0
        SaleDetail.Print()
   End
End

For this example, some of the output from the report is illustrated, in Product Name order:

Product Name: CatBathSoap

Sold Quantity:

     0

Product ID: 7

Customer ID:

       None

Product Name: Chips for Cats

Sold Quantity:

     50

     14

Product ID: 2

Customer ID:

        2

        1

Product Name: DogBelt

Sold Quantity:

    0

Product ID: 6

Customer ID:

       None

Product Name: Gimborn R-7

Sold Quantity:

     0

Product ID: 3

Customer ID:

       None

Product Name: KittenCaps

Sold Quantity:

     10

     34

Product ID: 2

Customer ID:

        3

        2