HomeStartingEnvironmentDBMSVisualPQLProceduresSQLFormsHost/APIIndex
Forms homecontents start chapter top of pagebottom of pagenext page index LOOKUP

LOOKUP

LOOKUP uses another screen to locate a record. If the specified record is not found, an error message is issued. The LOOKUP can reference or retrieve data from the specified record. See
syntax.

The stand-alone LOOKUP command is very similar to the LOOKUP clause of the FIELD command.

LOOKUP can perform a number of functions:

homecontents start chapter top of pagebottom of pagenext page index

Syntax

The LOOKUP command must specify the ON screen_name clause. Available clauses are:
LOOKUP {lookup expression}
   [NOT]ON screen_name[ /database.record | /tabfile.table]
   BACKWARDS | FORWARDS  n
   ERROR nnn 'message'
   IF ( expression )
   IN  expression
   LOCK locktype
   REPORT 'message'
   RETURNING expression, ...  TO variable, ...
   USING caseid  [ * ] | [ key, ...  ]
   VIA             *   |   key, ...
lookup expression
[NOT]ON
screen_name
BACKWARDS n|
FORWARDS n

ERROR
IF
IN
LOCK
REPORT
RETURNING
USING
VIA
Since the stand-alone lookup is not positioned on an input field, the test cannot be "required" since control has to continue to the next field. Use the lookup clause on the field command, to enforce the checking and re-entry of fields. The stand alone lookup is normally used to retrieve data.

Example: This returns the location status to a temporary field XSTATUS (which has been DECLARED on the FORM command) and then displays the result.

LOOKUP ON LOCREC USING -1, LOCATION -
       RETURNING STATUS to XSTATUS -
       ERROR 59 'Invalid Location Code - Please Re-enter'
FIELD XSTATUS DISPLAY 'Location Status'

homecontents start chapter top of pagebottom of pagenext page index