I. EQUEL/FORMS Examples : Getoper
 
Share this page                  
Getoper
Gets comparison operators from fields and columns of a form displayed in query mode.
Example--getoper statement:
The following example builds a query using the getoper function. This example uses a query operator array that maps the integer codes of FRS query operators to their corresponding query language operators. Array subscripts begin at 1.
## oper_chars array(6) of character_string(2)
## voper      integer
## vnum       integer
## where_clause character_string(30)
   oper_chars = ("= ", "!=", "<", ">", <=", ">=")
## display empform query /* use query mode */
## activate menuitem "retrieve"
## {
##  getform empform (vnum = eno, voper = getoper(eno))
    if (voper > 0) then
##     /* construct where_clause like: e.eno = 18 */
       where_clause = "e.eno " + oper_chars(voper) + enum
    else
       /* nothing entered, use "truth" default */
       where_clause = "1 = 1"
    end if
##  retrieve (vnum = e.eno, vname = e.ename,
##             vage = e.age)
##         where where_clause
##   {
           process rows
##   }
## }