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.
iterator
The profile or persistent class to read. If a class is specified, records are read using the class's default profile. The specified class can also be an external class with persistent members.
argument (first)
The key values to read. These are also known as high-order values.
This command option is compulsory if no start values are specified.
The total number of high-order and start values must be the same as the number of profile keys.
,…n
The key values to start reading back from.
FROM
Reads records in profile order.
BACK
Reads records in reverse profile order.
argument (second)
The key values to start reading from, if the From command option is specified. Otherwise, the key values to start reading back from, if the Back command option is specified. These are also known as start values.
This command option is compulsory if no high-order values are specified.
The total number of high-order and start values must be the same as the number of profile keys.
UNTIL ( arguments )
The terminating key values. These are also know as end values.
This command option is only valid if start values are specified.
The number of end values must be the same as the number of start values.
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 records
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.
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
The order in which records are read using the From and Back command options.
The initial record read using the high-order and start values.
The final record read using the high-order and end values.
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:
High-order, start, or end values should not be changed within a Determine Group logic command loop.
If the Determine Group Serial logic command variant is invoked by a copy ispec or copy event, the high-order, start, and end values should not be changed within the same method.
If a Determine Group logic statement terminates normally, the contents of the memory are undefined, due to host platform differences.
It a Determine Group logic statement is terminated using a Break or JumpTo logic command, the current record remains in memory.
Array attributes should not be used as key values, as the results might not be consistent.
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 |