/* Requires a connection to the Sports2000 database. Define data items */
DEFINE VARIABLE funcs AS CHARACTER NO-UNDO EXTENT 5
INITIAL ["firstrec","lastrec","nextrec","prevrec","quitting"].
DEFINE VARIABLE action AS CHARACTER NO-UNDO LABEL "Action" FORMAT "x"
INITIAL "N".
DEFINE VARIABLE idx AS INTEGER NO-UNDO.
DEFINE VARIABLE alldone AS LOGICAL NO-UNDO.
FORM WITH FRAME x SIDE-LABELS 2 COLUMNS 1 DOWN COLUMN 25.
/* Define user-defined functions */
FUNCTION dispcust RETURNS LOGICAL:
DISPLAY Customer EXCEPT Customer.Comments WITH FRAME x.
END.
FUNCTION firstrec RETURNS LOGICAL:
FIND FIRST Customer.
dispcust().
RETURN yes.
END.
FUNCTION lastrec RETURNS LOGICAL:
FIND LAST Customer.
dispcust().
RETURN yes.
END.
FUNCTION nextrec RETURNS LOGICAL:
FIND NEXT Customer NO-ERROR.
IF AVAILABLE Customer THEN
dispcust().
RETURN AVAILABLE(Customer).
END.
FUNCTION prevrec RETURNS LOGICAL:
FIND PREV Customer NO-ERROR.
IF AVAILABLE Customer THEN
dispcust().
RETURN AVAILABLE(Customer).
END.
FUNCTION quitting RETURNS LOGICAL:
alldone = yes.
RETURN no.
END
/* Main routine */
REPEAT WHILE NOT alldone:
UPDATE action HELP
"Enter F(irst), L(ast), N(ext), P(rior), or Q(uit) to navigate.".
idx = LOOKUP(action,"f,l,n,p,q").
IF idx EQ 0 THEN DO:
MESSAGE "Enter F(irst), L(ast), N(ext), P(rior), or Q(uit)"
VIEW-AS ALERT-BOX.
NEXT.
END.
DISPLAY DYNAMIC-FUNCTION(funcs[idx]) LABEL "Record Found?".
END.
|