Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » using if statement in a rule ?
using if statement in a rule ? [message #892742] Fri, 29 June 2012 13:05 Go to next message
Kosala Yapa is currently offline Kosala Yapa
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: using if statement in a rule ? [message #893343 is a reply to message #892742] Tue, 03 July 2012 16:00 Go to previous message
Fernanda R.F. is currently offline Fernanda R.F.
Messages: 64
Registered: May 2012
Member
Hi,

I'm not really sure about it, but I think isn't possible to use if condition into rules.
You will need to do a helper and then call it in the rule.

Example:


helper x1 (value: Integer): Boolean =

if (value = 1) then
 true
else
 false;


rule xxx {

from a: input!bla

to b: output!bla {

bool <- a.x1(2);

} 



I hope it help you.

Previous Topic:a visual representation for atl?
Next Topic:ATL transformation
Goto Forum:
  


Current Time: Thu Oct 23 08:02:57 GMT 2014

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

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