Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » problem with the iteration
problem with the iteration [message #1764570] Wed, 31 May 2017 10:52 Go to next message
im hello world is currently offline im hello worldFriend
Messages: 44
Registered: February 2017
Member
Hi,
In the following code, i want that the id takes in each iteration a number from the sequence 's', so as a result in my target model i obtain the id 1 then 2 if i had 2 source elements, 1,2,3 if i had 3 source elements etc...
 from...
to 
split: ABC!Loc (
			id <- let s: Sequence(Integer) = Sequence{1, 2, 3, 4, 5} in 
s->iterate(e; res : Integer = s->first() |( e).toString()),



the problem is, i always get the last element in my target model, my id are always 5 , there is no iteration on 's' to get the following ids: 1,2 for example.

please, how to make this happen.
regards

Re: problem with the iteration [message #1764643 is a reply to message #1764570] Thu, 01 June 2017 07:01 Go to previous message
Carlos Sáenz  is currently offline Carlos Sáenz Friend
Messages: 6
Registered: May 2017
Junior Member
Why don't you use allInstances() together size() methods?

For example:

from
s: ...........

to
split: ABC!Loc ( )

do{
split.id<- s.allInstances()->size().toString();

}
Previous Topic:synchronisation between counters in two separated matched rules
Next Topic:Lazy rule: problem with a counter
Goto Forum:
  


Current Time: Fri Nov 16 21:59:44 GMT 2018

Powered by FUDForum. Page generated in 0.01692 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top