How to use Drools Template

Solution Unverified - Updated -

Issue

  • I'm using Drools Template feature by ExternalSpreadsheetCompiler with DRT and XLS files. I see that the generate DRL line is discarded when one of data in XLS is empty. I want to discard the complete fact pattern only when all attribute data are empty. Let's suppose that we have a DRT like this:
rule "person_@{row.rowNumber}"
    when
        $p : Person( age <= @{age}, gender=="@{gender}" )
    then
        //
end

And we have cell values like this:

age    , gender
----------------
18     ,f
18     ,<empty>
<empty>,f
<empty>,<empty>

I expect

rule "person_1"
    when
        $p : Person( age <= 18, gender=="f" )
    then
        //
end

rule "person_2"
    when
        $p : Person( age <= 18 )
    then
        //
end

rule "person_3"
    when
        $p : Person( gender=="f" )
    then
        //
end

rule "person_4"
    when

    then
        //
end

But actually, it is rendered like:

rule "person_1"
    when
        $p : Person( age <= 18, gender=="f" )
    then
        //
end

rule "person_2"
    when

    then
        //
end

rule "person_3"
    when

    then
        //
end

rule "person_4"
    when

    then
        //
end

Environment

  • Red Hat JBoss BRMS
    • 6.1.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.