Hi Vlad,

With the new decision table handling you could use the following template to do it:

Given a table as follows:

exists, 21, 25

, comprehensive

not, 64, 100

exists, comprehensive

the following template does what you want:

template header
driver[]
policy[]

package This_is_a_ruleset;
#generated from Decision Table
import example.model.Driver;
import example.model.Policy ;

template "Driver policy"
driver
policy

rule "driver policy $row.rowNumber$"
    when
        $driver0$
        Driver(age >= $driver1$, age <= $driver2$)
        $policy0$
        Policy(type = "$policy1$")
then
    //do smth
end
end template

the code to call it was:
    public void testColumnKeywords() {
        final ExternalSpreadsheetCompiler converter = new ExternalSpreadsheetCompiler();
        final String drl = converter.compile( "/data/TestWorkbook.xls", "/templates/test_keywords.drl",
                                              InputType.XLS, 1, 1 ); // DT starts at Row 1, Column 1
        System.out.println(drl);
    }

cheers
Steve

On 2/17/07, Olenin, Vladimir (MOH) < Vladimir.Olenin@moh.gov.on.ca> wrote:

Hi,

 

I wonder if it's possible to pass some Column keywords as parameters from template values, eg:

 

Condition

Condition

$1 Driver

$1 Policy

age >= $2, age <= $3

type

exists, 21, 25

, comprehensive

not, 64, 100

exists, comprehensive

 

I'd expect the above table would generate two rules like:

 

Rule 1

When

            exists Driver (age >= 21, age <= 25)

            Policy(type == "comprehensive")

Then

            // do smth

End

 

 

Rule 2

When

            not Driver (age >= 64, age <= 100)

            exists Policy (type == "comprehensive")

then

            // do smth

End

 

 

 

The above example is just a mock up derived from one of the examples in the documentation to demonstrate the point (meaning, the rules themselves might not make sense from business point of view or can be implemented differently for this particular case).

 

So, any way to achieve this? Whether in current version (3.0.x) or the upcoming release (3.2)

 

Thanks,

 

Vlad


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw@objectconsulting.com.au
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference