On 23 August 2012 17:08, Michael Anstis <michael.anstis(a)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(a)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-tp40193...
> Sent from the Drools: User forum mailing list archive at
Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users