LOOP macro cardinality error


I am trying to insert a LOOP macro inside a method as follows:

The item I want to iterate over has multiple cardinality for sure, but I keep getting the following

ERROR: Node under $LOOP$ macro should have multiple cardinality (role:body). 

But if I write the same statement outside the execute() method, it works.

I tried another approach which gave puzzling results too.

I made the first line inside the execute() method a different executable statement and then put the $LOOP$ macro. The earlier error goes away but the content inside it is highlighted in RED & no longer appears when I do preview generated text.

Could someone explain what's going on please?

1 comment

Methods have body which is a StatementList of cardinality 1. StatementList has role statement of multiple cardinality. They aren't clearly distinguished in the editor so you have managed to put your $LOOP$ on body instead of statement and that's what the unclear error message is trying to tell you (it says "role:body").

The red text error probably means that the text you are typing in wasn't recognized as a statement. Not sure why. The red text is probably not even stored in the model, that's why you don't see it when you preview generated text.


Please sign in to leave a comment.