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)  
SET VARIABLE v1 = count(mname) 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 from Field" box in the "Field Settings" 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 = ' '  
    SET VARIABLE vage TEXT = ' '  
    DIALOG 'Enter name of member to add' vmname +  
          vendkey 1   
    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)  
    SET VARIABLE v1 = count(mname) 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  
Field Calculations  
Redisplaying Field Values  
RECALC Command Options  
Screen Data Displays  
EEP Restrictions