
The list records command tells DataEase which items to display in the procedure output for each record processed by a script. These items are called list items. Although the most common list item is a fieldname, a list item can also be a constant, a variable, or any other expression you want to include in the report output.
Syntax
for TABLENAME | RELATIONSHIP
list records
FIELDNAME |VARIABLE NAME | LITERALS ;|.
list records [in FORMNAME | RELATIONSHIP
[named "UNIQUE RELATIONSHIP NAME" ]
Each list item must be followed by a semicolon except the last, which is followed by a period. To sort, group, or generate statistics on a list item specified in a list records command, insert the appropriate operator after the list item. You cannot list or modify more than 255 fields in a single DQL Procedure.
Example 1
list records
STATE in groups ;
TOTAL DUE : item min max sum .
This script tells DataEase: (1) Process all the MEMBERS records with the same value in the STATE field together as a group, (2) display the group identifier (STATE) once at the beginning of each group, (3) within each group, arrange the members in alphabetical order by LAST NAME, (4) list each member's TOTAL DUE (item), (5) list subtotals of each specified statistic for each STATE group (in groups with group-totals), (6) list the smallest TOTAL DUE (min), (7) list the largest TOTAL DUE (max), and (8) list the sum of all the TOTAL DUE amounts combined (sum). Theoutput might look as follows:
State |
Last Name |
Total Due |
... |
... |
... |
KY |
Bouchard |
$100.00 |
|
Denofsky |
$70.00 |
|
Steiner |
$115.00 |
|
Group Total |
$285.00 |
|
|
|
LA |
Orsini |
$85.00 |
|
Rodriguez |
$100.00 |
|
Simpson |
$85.00 |
|
Group Total |
$270.00 |
... |
... |
... |
Minimum Total Due |
$280.00 |
Maximum Total Due |
$35.00 |
Sum Total Due |
$18,190.00 |
Although list records is usually used with the for command to list data, you can also use list records to list text literals, values stored in variables, and other values. For example, the script below prints Club ParaDEASE cruise boarding passes. It lists a text literal and values stored in a variable, joined together using the jointext function:
define temp "CRUISETICKETNUM" Number .
assign temp CRUISETICKETNUM := 0 .
while temp CRUISETICKETNUM < 1000 do
temp COUNTER := temp CRUISETICKETNUM + 1 .
list records
jointext( " Boarding Pass No. " , CRUISETICKETNUM ) .
The example above tells DataEase to: (1) Create a temporary variable named CRUISETICKETNUM and to assign it an initial value of zero, (2) evaluate the condition following the word while, and if the value of CRUISETICKETNUM is less than 1000, execute the actions following the word do until the end command, and (3) reevaluate the condition (CRUISETICKETNUM <1000), and if it is still true, repeat the actions until the condition becomes false.
Each time the actions are executed, the list records command tells DataEase to print the text string, "Boarding Pass No.", followed by the current value in the CRUISETICKETNUM variable. Notice that the text string "Boarding Pass No." includes a single trailing space so the ticket number prints in the correct location.
The output for this procedure might look as follows:
Boarding Pass No. 1
Boarding Pass No. 2
Boarding Pass No. 3
Boarding Pass No. 4
Product: Dataease [{8}]FIVE. Written by Rainer 11/09/13 at 20:15:28
Product: Dataease [{8}]FIVE. Written by DataEase 12/09/13 at 06:48:10
Product: Dataease [{8}]FIVE. Written by DataEase 12/09/13 at 07:08:17
Product: Dataease [{8}]FIVE. Written by Rainer 12/09/13 at 21:29:32
Product: Dataease [{8}]FIVE. Written by DataEase 13/09/13 at 14:42:12
Product: Dataease [{8}]FIVE. Written by Rainer 14/09/13 at 20:15:23
Product: Dataease [{8}]FIVE. Written by DataEase 15/09/13 at 07:16:50
Product: Dataease [{8}]FIVE. Written by Rainer 15/09/13 at 18:43:29
Product: Dataease [{8}]FIVE. Written by DataEase 16/09/13 at 09:48:35