Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » use of if condition ?
use of if condition ? [message #892736] Fri, 29 June 2012 12:07 Go to next message
Kosala Yapa is currently offline Kosala YapaFriend
Messages: 159
Registered: September 2010
Senior Member
rule rule_getDevice{
from
a: source!DeviceItem
to
p:target!Device(
name <- a.Name,
s7DeviceReference<-a.DeviceReference,
isSelectedWithinStep7<-a.IsSelected,
if (a.IsSelected = 'true'){
HeadModule<-a.ModuleList.ModuleItem->select(mi|mi.getSlotValue()='0')->collect(e|thisModule.rule_getHeadModule(e))->first();
Module<-a.ModuleList.ModuleItem->select(mi|mi.getSlotValue()<>'0')->sortedBy(mi|mi.getSlotValue().toInteger())->collect(e|thisModule.rule_getModule(e));
}
)
}

syntax error: no viable alternative at input.

can someone help me to resolve this issue?

Thanks in advance.
Kosala


Re: use of if condition ? [message #892764 is a reply to message #892736] Fri, 29 June 2012 14:17 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 523
Registered: July 2009
Senior Member
Use the imperative do section.
In declarative sections the "if" have to be in the OCL form : if cond then stmt else stmt endif

rule rule_getDevice{
from
a: source!DeviceItem
to
p:target!Device(
name <- a.Name,
s7DeviceReference<-a.DeviceReference,
isSelectedWithinStep7<-a.IsSelected
)
do{
if (a.IsSelected = 'true'){
p.HeadModule<-a.ModuleList.ModuleItem->select(mi|mi.getSlotValue()='0')->collect(e|thisModule.rule_getHeadModule(e))->first();
p.Module<-a.ModuleList.ModuleItem->select(mi|mi.getSlotValue()<>'0')->sortedBy(mi|mi.getSlotValue().toInteger())->collect(e|thisModule.rule_getModule(e));
}
}
}
Re: use of if condition ? [message #892955 is a reply to message #892764] Mon, 02 July 2012 07:20 Go to previous message
Kosala Yapa is currently offline Kosala YapaFriend
Messages: 159
Registered: September 2010
Senior Member
Hi Sylvain,

Thanks a million.

Kosala
Previous Topic:ERROR
Next Topic:a visual representation for atl?
Goto Forum:
  


Current Time: Mon Nov 24 01:27:32 GMT 2014

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

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