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