I. EQUEL/FORMS Examples : Getrow
 
Share this page                  
Getrow
Gets values from a table field row.
Examples--getrow statement:
Example 1:
This example gets information from the first row of the table field display:
## activate menuitem "getfirst"
## {
##   getrow empform employee 1
##        (vnum = eno, vname = ename, vage = age, 
##         vsal = sal, vdept = dept)
## }
Example 2:
This example finds out if the current row has been modified:
## activate menuitem "rowchanged?"
## {
##   getrow empform employee
##        (vname = ename, state = _state)
     if (state = 1 or state = 3) then 
     /* new or changed */
          msgbuf = "you have modified " + ename
##        message msgbuf
##        sleep 2
     end if
## }
Example 3:
This example illustrates the use of null indicator variables when getting a nullable value from a column in a table field:
## activate menuitem "moreinfo"
## {
##   getrow empform employee
##        (vname = ename, vage = age,
           vspouse:indicator_var = spouse)
     /* -1 means no spouse or children */
     if (indicator_var <> -1) then 
          find information about children, if applicable
     end if
     display more detailed information
                  on retrieved employee
## }
Example 4:
This example retrieves the current values of row 2 and replaces that row in the database using getrow and replace param target lists.
addresses(1) = address_of(vage)
addresses(2) = address_of(vsal)
    get_target_string = "%i4 = age, %f4 = sal"
    put_target_string = "age = %i4, sal = %f4"
## getrow empform employee 2
## (param(get_target_string, addresses))
## replace employee (param(put_target_string, addresses))