[rules-users] Drools with rules from database

Michael Anstis michael.anstis at gmail.com
Thu Aug 23 14:18:30 EDT 2012


I knew I was on dangerous ground :)

Thanks Wolfgang for tying up my loose end.

At least you didn't change it to employesalary.color == "director" which
would have confused me ;)

On 23 August 2012 19:01, Wolfgang Laun <wolfgang.laun at gmail.com> wrote:

>
>
> On 23 August 2012 17:08, Michael Anstis <michael.anstis at gmail.com> wrote:
>
>> You will need to insert both Employee and EmployeeTypeSalary objects into
>> WM:-
>>
>> Employee( "manager" )
>> Employee( "director" )
>> EmployeeTypeSalary( "manager", 100 )
>> EmployeeTypeSalary( "director", 300 )
>>
>> You won't need any more rules than the one shown. This rule will not need
>> to be changed.
>>
>
> Only a little :)
>
> The way it is written it will loop. Either add the rule attribute
>    no-loop true
> or
>     $e : Employee( employeeType ==  $et, salary == null )
> or
>     $e : Employee( employeeType ==  $et, salary == 0 )
> depending on the type if Employee.salary.
>
> -W
>
>
>
>>
>> Just insert your reference data (EmployeeTypeSalary) and employee data
>> (Employee) into Working Memory.
>>
>> How you get both the reference data and employee data is up to you. I'm
>> not about to embark on JDBC\JPA etc lessons.
>>
>>
>> On 23 August 2012 15:16, debchamps <majumdar.debarghya at gmail.com> wrote:
>>
>>> So the thing is I will have rules like
>>>
>>> when
>>>   EmployeeTypeSalary( $et : emplyeeType, $s : salary )
>>>   $e : Employee( employeeType ==  $et )
>>> then
>>>   modify($e) {
>>>     setSalary( $s );
>>>   }
>>> end
>>>
>>>
>>> But by taking the value from db the rules will look like
>>> if(employesalary.color == "manager")
>>> employesalary.salary = 100
>>>
>>> if(employesalary.color == "director")
>>> employesalary.salary = 300
>>>
>>> There is only one template
>>>
>>> But I want to take this rules from db i.e
>>> employee salary
>>> -------------------
>>> manager 100
>>> director 300
>>>
>>>
>>> For this I need some reference/example specially for connecting Drools
>>> with
>>> db and how the things work.
>>>
>>> Thanks,
>>> Deb
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://drools.46999.n3.nabble.com/Drools-with-rules-from-database-tp4019357p4019361.html
>>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120823/475ae091/attachment-0001.html 


More information about the rules-users mailing list