0
votes

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:

  • Everything written needs to be contained within the Disp function.
  • I can't use previously created functions.
1
I don't believe Progress will let you nest a loop inside the display. You'd have better luck using the index function, or if lookup is necessary to avoid near matches, do it before the display and save the result to a logical variable, for example. - bupereira

1 Answers

2
votes

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