[rules-users] A Simple Rule ( using Guided editor )
Przemysław Różycki
P.Rozycki at amg.net.pl
Thu Jan 29 05:57:34 EST 2009
Ashish Soni pisze:
> Hi All ,
>
> I am just trying to write a simple rule but not sure how can i write it
> , Please help me as i am new to drools and still in the learning phase .
>
> I have a below Fact with three fields
>
> Person
>
> firstName
> lastName
> fullName
>
>
> Now i want to assign fullName = firstName + lastName which i am not able
> to find out how can i do that.
>
> I am able to define the *when *part using guided editor but able to
> define *then *part , Please help
>
> *rule "PersonRules"
> dialect "mvel"
> when
> p : Person( firstName != "" && lastName != "" )
> then*
>
> Thanks,
> Ashish
>
What about just:
rule "PersonRules"
dialect "mvel"
when
p : Person( firstName != "" && lastName != "" )
then
modify(p) {
fullName = p.firstName + p.lastName
}
?
Consider also using no-loop attribute in such a rule.
Best regards,
Przemek
More information about the rules-users
mailing list