If you have a stack trace in your error log I would like to see it. Maybe we go into an out of memory here. Also there is a missing endfor, and I fixed an issue in the parser recently that could explain the infinit loop in the parser.
But with two loops nothing prove you will get f elements in the rep.name order.
An other way to get all representations would be to navigate de DAnalysis object:
rep.getDescriptor().eContainer(viewpoint::DAnalysis).ownedViews.ownedRepresentationDescriptors
You can store the expression value in a variable using a let. Lets call it descriptors. Then you can filter on the representation description name and sort by the representation name:
descriptors->select(d | d.description.name = ‘Logical Architecture Blank’).representation->sortedBy(r | r.name)
this will give you a list of representation. You can then loop over this list and to get the element f in your previous example you can use:
representation.target
All put together:
{m:let descriptors = rep.getDescriptor().eContainer(viewpoint::DAnalysis).ownedViews.ownedRepresentationDescriptors }
{ m:for representation | descriptors->select(d | d.description.name = 'Logical Architecture Blank').representation->sortedBy(r | r.name) }
{ m:representation.name }
{ m:representation.target }
{ m:endfor }
{ m:for representation | descriptors->select(d | d.description.name = 'Component Exchanges Scenario').representation->sortedBy(r | r.name) }
{ m:representation.name }
{ m:representation.target }
{ m:endfor }
{ m:endlet }