We are trying to write a loop macro with the break function. Basically, we would like to repeat a specific action until the X value (obtained from the dataset) is true. The compiler does not seem to like this approach (returns "Waiting for a constant"), so we were wondering if there is a known workaround?
The following is a completely artificial example called:
LoopFunction(5);
from the BWR window.
EXPORT LoopFunction(NMax = 5) := MACRO
Rec := RECORD
INTEGER i;
END;
OUTPUT(DATASET([1], REC), ,'~TEMP::MB::LOOPTEST' + %i%, COMPRESSED, OVERWRITE);
shouldIbreak := DATASET('~TEMP::MB::LOOPTEST' + (%i% - 1), Rec, THOR);
OUTPUT(shouldIbreak +DATASET([%i%], REC), ,'~TEMP::MB::LOOPTEST' + %i%, COMPRESSED, OVERWRITE);
ENDMACRO;
source
share