Other Directives
This section describes further directives that are available to the OPENworkshop developer.
LOOKUP SCREEN
Section titled “LOOKUP SCREEN”The LOOKUP SCREEN directive may be used within a data element name Valid Values field to specify a screen definition to be used when the user selects Lookup Screen (F9) in a view or a screen. LOOKUP SCREEN enables the default screen defined in the link to be overridden.
Typically, the called screen will be used to supply full details about an object that is displayed or referenced by the data item displayed. The normal use of LOOKUP SCREEN when in a screen or a view is to switch from a screen to a view or a view to a screen for a specific data record. LOOKUP SCREEN allows the lookup to be extended to connect to any screen in the application.
From a view, the field must be in entry mode before the LOOKUP SCREEN will be honored.
The syntax for LOOKUP SCREEN is:
LOOKUP SCREEN screen-nameLOOKUP VIEW
Section titled “LOOKUP VIEW”LOOKUP VIEW may be specified within a data element name Valid Values field to assist in validation of data input by the user. On completion of input in a data element name within a view or a screen where LOOKUP VIEW has been specified, OPENworkshop will compare the received data with key values in the specified view. If there is a match the field is accepted. If there is no match, then OPENworkshop connects to the view, scrolling the rows to the nearest match. The user is then able to move to the desired row and select OK (Enter) to select the record.
Note: The maximum length of the full lookup syntax is 256 bytes.
Syntax is:
LOOKUP[(function-key-number)] VIEW view-name[ERMFIRST;] [SPACEOK] [USING data element name or expression;][LET expression; or directive; ENDLET]-
If ERMFIRST is specified a brief error message:
The value entered is not contained in the lookup fileDisplays before the connect to the view is made. Close (F4) returns to user input, allowing the field to be re-entered. Any other response connects to the view.
-
If the function key number is used, when in input mode the view will be displayed when the function key is pressed.
-
If SPACEOK is specified then blank entries will be accepted.
-
The optional USING clause may be used to restrict the number of rows displayed in the connected view.
-
A variable :OIN is provided, containing the value entered by the operator. This may be used to construct the key. :OIN can also be assigned a value by the LET / ENDLET directive.
-
Variable :DIR may be assigned method return directive value(s). These directives will be executed on return from the lookup view.
Example
LOOKUP(2) VIEW OEVINV0 USING #OEFPARM.DEPT + :OIN;LET #OEFINVD.INV-LPRICE = #OEFINVH.ITEM-PRICE;#OEFINVD.ITEM-CODE = #OEFINVH.ITEM-CODE;:DIR="PRINT ROW"; :OIN=#OEFINVH.ITEM-CODE; ENDLETMethod Return Directives
Section titled “Method Return Directives”Method return directives provide a means for methods to communicate directives or status flags back to a screen or view that invoked the method. Return directives are only evaluated by screens and views.
The method must place the directive(s) in string array MSG1$[0] before returning. If more than one directive is to be returned they must be separated by semicolons.
-
Print the help specified by the help-code.
ERROR [help-code] -
Exit the screen or view. Does the same as a Close (F4).
EXIT -
Move the cursor to the specified column number (for a view), field number (for a screen) or data element name.
GOTO FIELD Field-number | Data Element Name -
Move to the row with the specified key value. Only meaningful to a view.
GOTO KEY Key-value | "Key-value" -
Print the data record in the view or screen.
PRINT [ROW] -
Write the current record to file.
WRITE -
Specifies the normal completion of connected method.
. (period) -
Determine the number of rows to scroll up/down.
SCROLL UP | DOWNSCROLL DOWN 10SCROLL UP 10SCROLL DOWN 10; GOTO FIELD data-name -
This allows you to scroll to the right and left of a locked column, leaving the cursor on the current column.
TAB | TAB BACKTAB 5TAB BACK 5 -
Signifies the method did not complete normally.
[Any other value]
Example:
IF MSG1$[1]<>"" ! If line number generated MSG1$[0]="PRINT ROW;"+ ! Set return "GOTO FIELD 5" ! directives.ELSE ! else MSG1$[0]="ERROR OEERM01" ! Set error return.FI; ! endifThoroughbred Basic Method CONNECT Equivalents
Section titled “Thoroughbred Basic Method CONNECT Equivalents”Thoroughbred Basic methods may also invoke the equivalent of CONNECT directives. Behavior and requirements are similar to those of script methods.
The CONNECT directive is not valid in Thoroughbred Basic, and the Thoroughbred Basic Environment will not automatically create and dimension the string arrays used to communicate parameters and messages. The Thoroughbred Basic method must dimension the required arrays and CALL a program as follows: