Skip to main content



      Home
Home » Modeling » ATL » use of if condition ?
use of if condition ? [message #892736] Fri, 29 June 2012 08:07 Go to next message
Eclipse UserFriend
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 10:17 Go to previous messageGo to next message
Eclipse UserFriend
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 03:20 Go to previous message
Eclipse UserFriend
Hi Sylvain,

Thanks a million.

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


Current Time: Wed Jul 23 15:25:09 EDT 2025

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

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

Back to the top