Kbase 18591: 4GL. Sample Program to Display Words in Word Index Alphabetically
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  27/07/2004 |
|
Status: Unverified
GOAL:
Sample Program to Display Words in Word Index Alphabetically
FACT(s) (Environment):
Progress 4GL
FIX:
The following sample program breaks down a character string from a table in a space-delimited list, and displays all the words alphabetically.
This is especially useful for word indices.
Use the following program as an include file or as a separate program.
/********* Program WordIndex.p ************************/
DEFINE VARIABLE int-var AS INTEGER INITIAL 1 NO-UNDO.
DEFINE TEMP-TABLE tmp-table
FIELD holder AS CHARACTER FORMAT "x(15)"
INDEX idx IS PRIMARY holder ASCENDING.
/******* Fetch field for list ***********************/
FIND FIRST <TABLE> NO-LOCK NO-ERROR.
/******* Populate list *******************************/
IF AVAILABLE <TABLE> THEN DO:
DO int-var = 1 TO NUM-ENTRIES(<FIELD>, " "):
CREATE tmp-table.
ASSIGN holder = ENTRY(int-var, <FIELD>, " ").
END.
END.
/******* Display list ********************************/
FOR EACH tmp-table:
DISPLAY holder WITH CENTERED ROW 10 NO-LABELS.
END.
/******* Program WordIndex.p **************************/