DOCUMENT #768
     ===========================================================================
     CLEARING VARIABLES BETWEEN ROWS
     ===========================================================================
     PRODUCT:  R:BASE                       VERSION:  4.5+ or Higher
     ===========================================================================
     CATALOG:  Forms, Reports & Labels      AREA   :  Forms
     ===========================================================================
 
     Often variables are located on a form instead of columns, particularly when 
     using EEPs. If the variable has a form expression associated with it, it 
     gets it's value each row from the expression. Form expressions are evaluated 
     as a row is read in. If the expression returns a NULL then the variable 
     located on the form displays as NULL. You don't need to worry about previous 
     row values displaying. However, if the variable does not have a form 
     expression associated with it, for example, it's value is determined by an
 
     EEP, then it is treated like a constant and the current value of the 
     variable is displayed. This means that previous row values are displayed 
     until new data is entered or an EEP is executed. This can cause confusion to 
     the user.
 
     There are three relatively easy ways to force variables to redisplay as 
     NULL on each new row. Because you may have a form expression that loads the 
     variable value into a column, colname = .varname, you don't want to use a 
 
     form expression to do this. You can use an EEP to set the variables to NULL, 
     or use a default value or format mask in the Field settings. Or, you can 
     simply display the values using the WRITE command in an EEP instead of 
     actually locating the variables.
 
     Using an EEP
 
     When using an EEP to set variables to NULL it's placement is vital. As a 
     new row is set up in a form, variable values and default values are 
     displayed before any EEP is executed. So if you place the EEP that resets 
 
     the variables to NULL On Entry into a row, it is executed after the 
     variables are displayed. They are reset to NULL, but that is not reflected
 
     in the screen display. Instead, place the EEP After saving row. This retains 
     any variable values needed for loading data, then sets them to NULL before
 
     the next row is displayed. The EEP contains a single SET VAR command.
 
     *(RESET.EEP)
     SET VAR var1 = NULL, var2 = NULL, var3 = NULL
     RETURN
 
     Note that the variables are simply reset to NULL, not cleared with the CLEAR 
     VAR command. You do not want to actually CLEAR a variable (remove it from 
 
     memory) in an EEP. That can cause problems with form execution.
 
     This is a good method when you have a number of variables. If you just have 
     one or two variables you may want to consider using the Field settings. 
     Using an EEP to reset the variables also works both when adding data with 
 
     the form and when editing data.
 
     Using Field settings
 
     You can set up a default value for a variable. Default values do not 
     require any programming and are stored with the form. They are only valid 
 
     when adding data however. When editing data, it is assumed that located 
     fields already have a value, thus defined default values are ignored. 
     Default values work well if you truly have a default value, or want a 
     default value other than NULL if users just enter through the field. You 
     may want a value of 999, for example, to indicate no entry instead of NULL. 
 
     A use of default values that requires a little bit of programming is to use 
     a variable as the default value. Define a variable of the appropriate 
     datatype at the R> prompt or in a Custom action in Application Express. 
     Leave the variable NULL. Place the dotted variable name as the default 
     value. When the form is run, the default variable value is picked up and 
     placed in the field.
 
     For example, use SET VAR vint INTEGER for an integer field, SET VAR vdate 
 
     DATE for a date field, etc.
 
     For TEXT fields, use a format mask instead of a default value. Use a mask 
 
     such as [%]. The format mask displays the field as blank. You can still 
     enter more data than the mask specifies, the mask is used only for the 
     initial display of the field when adding data.