Cornel
Cornel

Reputation: 72

Progress 4GL In-line functions / Multi-line statement

Description:

I am Writing/Editing a LinqToProgress query engine. So far simple functions within progress is simple to replicate, such as "A" >= "B" or Lookup(A, B) > 1, simple one liners that give boolean conditions. However to implement more advance function or custom functions I will need to be able to write multiline statements that can be plugged into conditions, meaning the inline function should be able to give a boolean result when you use DISP ( myFunc ) in the ABL ScratchPad (Using Eclipse) or similar programs.

Issue:

I need to convert the code between the //Start Here and //End Here to an inline boolean result.

DEF VAR i AS INT NO-UNDO.
DEF VAR LIST  AS CHAR NO-UNDO INIT "one,two,three,four".
DEF VAR LIST2 AS CHAR NO-UNDO INIT  "one,three,five". 

DISP(
        // Start Here
        DO i=1 TO NUM-ENTRIES(LIST):
        IF LOOKUP(ENTRY(i, LIST),LIST2) > 0 THEN RETURN TRUE.
        END.
        RETURN FALSE.
        // End Here
     )

Currently the code throws an error. White space after colon ends statement. I tried looking for solutions on multiline statements/inline functions but so far found nothing.

Constraints:

Upvotes: 0

Views: 419

Answers (1)

Mike Fechner
Mike Fechner

Reputation: 7192

You should introduce a method or function that contains your code block. The ABL does not support statements and blocks as an expression.

Upvotes: 2

Related Questions