Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand] loop with separator ,
[Xpand] loop with separator , [message #1220651] Thu, 12 December 2013 21:37 Go to next message
Adnan AL-SOSWA is currently offline Adnan AL-SOSWAFriend
Messages: 41
Registered: May 2010
Member
Hello all ,

I have problem getting the output the way I want ,
I have a model with some attributes and references . I want to have only list of my references that have Upperbound==1 separated by comma (,) , but the problem is that I got also extra commas fro also refrences that are Upperbound !=1
for example I have the following references :
type with upperbound==-1,
property with upperbound==1,
supertype with upperbound==1
by applying the following xpand code :
«EXPAND myrefrence FOREACH eAllReferences SEPARATOR ','-»

«DEFINE myrefrence   FOR ecore::EReference-»«IF upperBound==1»
('«name-»')
«ENDIF»
«ENDDEFINE»

I got the result :
( , property, supertype)

as you can see there is extra comma added , I want to ignore the extra comma that will be added when it ignores the reference that does not fit with the condition. any suggestions I appreciate

thank you in advance.
Re: [Xpand] loop with separator , [message #1220701 is a reply to message #1220651] Fri, 13 December 2013 07:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Maybe you should move the if the the loop expression

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xpand] loop with separator , [message #1221561 is a reply to message #1220701] Wed, 18 December 2013 00:46 Go to previous message
Adnan AL-SOSWA is currently offline Adnan AL-SOSWAFriend
Messages: 41
Registered: May 2010
Member
Thank you Christian .
I saw your answer for simliar question
it is about moving the condition to xpand part und use select to specify the needed refernces.

thanks a lot .
Previous Topic:[Acceleo] Custom DSL and Acceleo - questions
Next Topic:Jet2 Build bad Directive taglib
Goto Forum:
  


Current Time: Thu Apr 25 22:11:53 GMT 2024

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

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

Back to the top