Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Reference Index > Entry/Exit Procedures (EEPs)

EEP Example

Scroll Prev Top Next More

The following example of an EEP involves a family database comprised of two tables, family and members, designed to keep track of family members and their ages. The family table has columns for family name (fname), address (address), and city (city). The members table has columns for a family member's name (mname) and age (age).

 

In the family form, one field holds the variable v1, which keeps a running total of the number of family members. The variable v1 is set to increment based on the number of members in the members table. A variable vfname is set to the fname value of the family table so that the EEP (FENTRY.EEP) is able to correctly link the rows in the members table to the family table. The EEP name is placed in the "On Row Entry" box in the Table Settings dialog box in the Forms Designer, and consists of the following expressions:

 

*(fentry.eep)

SELECT COUNT(MName) INTO vCount FROM Members +

   WHERE FName = .vFName

RECALC VARIABLES

 

When the form is run, the FENTRY.EEP is run upon entry in the row. When [F2] is pressed to leave the fname field, an EEP (FEXIT.EEP) is run that prompts for a new family member and age to add to the members table. The EEP is placed in the "On Exit" EEP field in the "DB Edit" Properties dialog box for the fname column of the family table, and consists of the following expressions:

 

*(fexit.eep)

SET VARIABLE vKey = (LASTKEY(0))

IF vkey = '[F2]' THEN

   SET VARIABLE vMName TEXT = NULL

   SET VARIABLE vAge TEXT = NULL

   DIALOG 'Enter name of member to add' vMName vEndKey 1 +

       CAPTION 'Criteria...' ICON INFO

   SET VARIABLE DMess = ('Enter the age for' & .vMName)

   DIALOG .DMess vAge vEndKey 1

   SET VARIABLE vInt = (INT(.vAge))

   INSERT INTO Members VALUES (.vFName,.vMName,.vInt)

   SELECT COUNT(MName) INTO vCount FROM Members +

       WHERE FName = .vFName

   RECALC VARIABLES

   RECALC TABLES

ENDIF

 

Upon return to the form from FEXIT.EEP, FENTRY.EEP executes and recalculates the members table resulting in the redisplay of the v1 variable and shows the updated tally of family members, which is accomplished by using the RECALC VARIABLES and TABLES commands.

 

EEP Topics:

 

EEP Specific Commands

How to Define an EEP

Field Calculations

EEP Processing Order

Redisplaying Field Values

RECALC Command Options

EEP Restrictions