[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2t] Re: How to exit the FOR LOOP

Hi Omran,

There is no such functionality in either Acceleo or OCL. However what you seek seems like the "exists" collection iterator to me (and yes, "exists" does shortcut the evaluation if an element fulfills the condition).

----------8<----------
[if (mv.columns->select(oclIsTypeOf(ViewExpColumn))->exists(let exp : String = expression.trim().toUpper() in exp.startsWith('SUM') or exp.startsWith('AVG') or exp.startsWith('MIN') or exp.startsWith('MAX') or exp.startsWith('COUNT')))]
GROUP BY
[/if]
---------->8----------


Laurent Goubet
Obeo

Omran a écrit :
Dear All,

I have a for loop statement and under a specific condition I want to "exit" or "break" or "quit" the loop.

Does this capability exist?
here is the code that I am working on

[for (vc:ViewColumn|mv.columns)]
[if (vc.oclIsTypeOf(ViewExpColumn))]
[let vec : ViewExpColumn = vc.oclAsType(ViewExpColumn)]
[if (vec.expression.trim().toUpper().startsWith('SUM') or
vec.expression.trim().toUpper().startsWith('AVG') or
vec.expression.trim().toUpper().startsWith('MIN')or
vec.expression.trim().toUpper().startsWith('MAX') or vec.expression.trim().toUpper().startsWith('COUNT'))]
GROUP BY // I want here to exit the loop...how???
[/if]
[/let]
[/if]
[/for]



Thanks Omran

begin:vcard
fn:Laurent Goubet
n:Goubet;Laurent
org:<a href="http://www.obeo.fr/";>Obeo</a>
email;internet:laurent.goubet@xxxxxxx
url:http://www.obeo.fr
version:2.1
end:vcard