I. EQUEL/FORMS Examples : Inquire_frs
 
Share this page                  
Inquire_frs
Provides run-time information.
Examples--inquire_frs statement:
Example 1:
This example calls a clean-up routine if an error occurred:
## inquire_frs frs (err = errorno)
    if (err > 0) then
     call clean_up(err)
    end if
Example 2:
This example confirms that user changed some data on the currently displayed form before updating the database:
## activate menuitem "update" (validate = 1)
## {
##   inquire_frs form (updated = change)
     if (updated = 1) then
##        getform (newvalue = value)
##        append to newtable (value = newvalue)
     end if
## end
Example 3:
This example determines the mode and current field of the form specified by formname:
## inquire_frs form 
##   (modevar = mode(formname), fldname = field(formname))
This example provide a generalized help facility based on the current field name.
## activate menuitem "HelponField"
## {
##   inquire_frs form (fldname = field)
     place appropriate file for fldname into filebuf
##   helpfile "field help" filebuf
## }
Example 4:
This example makes sure that the current field in form empform is a table field before deleting the current row:
## activate menuitem "Deleterow"
## {
##   inquire_frs field empform (fldname = name,
##                               istable = table)
     if (istable = 0) then
##   message "you must be in the table field to delete ##
            the current row."
##   sleep 2
    else
##      deleterow empform fldname
##  end if
## }
Example 5:
This example enables the run-time user to change the row following the current row in a table field, verifies that the current field is a table field and that its next row is visible:
## activate menuitem "ChangeNextrow"
## {
##   inquire_frs field "" (istable = table)
     if (istable = 0) then
##        message "you must move to table field"
##        sleep 2
     else
##        inquire_frs table "" 
##             (fldname = name, currow = rowno,
##              vlastrow = lastrow)
          if (currow = lastrow) then
##              message "you must scroll in a new row"
##              sleep 2
          else
                currow = currow + 1
           /* update data in row specified by "currow."*/
          end if
     end if
## }
Example 6:
The following example inquires whether a field was changed by the run-time user:
## activate menuitem "Salary"
## {
##   inquire_frs field (changed = change(salary))
     if (changed = 1) then
          log salary change for employee
     end if
## }
Example 7:
The following example updates the database only if the user made changes:
## activate menuitem "Update"
## {
    /* check if a change was made to column "rank" in */
    /* the current row. */
    inquire_frs row (changed = change(rank))
    /* only need to update database
    ** if a change was made. 
    */
    if (changed = 1) then
         get information and update database
    end if
## }