Consultor Eletrônico



Kbase P109676: 4GL: How to assign an Array Field from an EDITOR one line per array element?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/6/2005
Status: Unverified

GOAL:

4GL: How to assign an Array Field from an EDITOR one line per array element?

FIX:

The following sample assumes that the EXTENT (number of elements ) of the Array Field is more or equal to the EDITOR:NUM-LINES ( number of lines in the EDITOR widget). It further assumes that each line in the EDITOR ends with a "RETURN" character; CHR(10). The code performs the followings tasks:
1. Finds the table record to be modified.
2. Reads the contents of the EDITOR widget into a CHARACTER variable.
3. Iterates as many times as there are lines in the EDITOR using the EDITOR:NUM-LINES property to assign an EDITOR line to the corresponding Array Field Element in each iteration.
DO:
DEFINE VARIABLE iCounter AS INTEGER NO-UNDO.
FIND CURRENT MyTableRecordBuffer EXCLUSIVE-LOCK.

ASSIGN
cVariable = EDITOR-1:SCREEN-VALUE IN FRAME {&FRAME-NAME}.
DO iCounter = 1 TO NUM-ENTRIES(cVariable, CHR(10)):
ASSIGN
cArrayField[iCounter] = ENTRY (iCounter, cVariable, CHR(10)).
END.
END.