[progress Communities] [progress Openedge Abl] Forum Post: Re: [4.5] - Breaking Out Of A Loop

  • Thread starter Thread starter Mohammed Siraj
  • Start date Start date
Status
Not open for further replies.
M

Mohammed Siraj

Guest
Another possible solution is to define the looping construct within a JS function. In the JS function, add a return statement on the break condition. Eg: function startLoop(){ {!#LOOP_BEGIN.R5707634#whjW7ZHgRyy6c7ADnW5sMA} if({!R5707634.isOpen#value}){ return true; // condition to break } {!#LOOP_END.R5707634} return false; } //invoke function startLoop(); Note: Loop template tokens in RB are pre-processed and a copy of embedded statements within a loop is added for each loop record with record specific values. This is done before the JS engine (browser or server-side) interprets the JS code snippet. Hence, it is not considered as an optimal approach for a large number of records esp. for employing static checks. This is more suited for creating HTML markup for each loop record and other similar use-cases. As suggested by Srinivas above, leveraging API support will be more relevant for this requirement.

Continue reading...
 
Status
Not open for further replies.
Back
Top