This section provides a basic report demonstration.
To see a demonstration of ABL behavior when displaying a report to your screen:
1. Open i-10-01.p and run it. The ABL Virtual Machine (AVM) creates a down frame that occupies all the vertical space it can and fills the frame with iterations of data. For example:
Notice the message at the bottom of the screen. the AVM pauses to allow you to view the first frame of data.
2. Press SPACEBAR. The AVM clears the down frame and fills it with a new set of iterations.
3. Press END-ERROR and then SPACEBAR to return to the Procedure Editor. Here is the code for this example:
i-10-01.p
DEFINE VARIABLE lBalDue AS LOGICAL NO-UNDO LABEL "Balance Due?"
VIEW-AS TOGGLE-BOX.
DEFINE FRAME Frame1
sports2000.Customer.Name
/*1*/ lBalDue VIEW-AS TEXT
/*2*/ WITH DOWN USE-TEXT CENTERED THREE-D.
/*3*/ FOR EACH Customer NO-LOCK WITH FRAME Frame1:
lBalDue = IF Customer.Balance > 0 THEN TRUE ELSE FALSE.
/*4*/ DISPLAY Customer.Name lBalDue.
END.
Note: The THREE-D option is relevant only on a Windows client; it is ignored by a character client.
The following notes help to explain the code:
1. The default data widget for this LOGICAL variable is a toggle box, making the VIEW-AS TEXT phrase necessary to convert it to a text widget.
2. The frame phrase of the DEFINE FRAME statement contains two key options: DOWN and USE-TEXT. The DOWN keyword specifies a down frame that automatically expands to fit as many iterations as the screen can hold. Specifying an integer before DOWN sets the maximum number of iterations the frame can hold. USE-TEXT converts all fill-in fields into text widgets for a compact display.
3. Since the great majority of reports compile and manipulate table data, the FOR EACH statement is the most common control block used for report procedures. The frame phrase here replaces the default down frame with the named down frame defined earlier.
4. The DISPLAY statement is the most commonly used output statement. As you'll see later, DISPLAY can output to terminals, printers, or files.
The type of report display created by procedure i-10-01.p does not fit well with the event-driven model because the user:
Does not control the display of data
Can view data in only one direction
Does not have an intuitive way to dismiss the report