Search code examples
droolskie-workbench

How to import data as number rather than string from excel file in Drools workbench?


First question. As shown in Fig 6.16 in 6.5.3. How Decision Tables Work, when imported the rule excel file to workbench, 'age' in Column C is considered as a string, that is,

Person(age=="42")

How to make it as a number? So in the rule we can get

Person(age==42)

Another question, when rule tables put in multiple sheets, only the one in the first sheet is recognized. Is that expected?


Solution

  • If you have a condition

    CONDITION
    Fact
    age >
    Test for age limit
    42
    

    the rule will contain

    Fact(age > "42")
    

    However, if you use

    CONDITION
    Fact
    age > $param
    Test for age limit
    42
    

    the rule will contain

    Fact(age > 42)
    

    But, normally, this should not matter and the outcome should be the same. Or can you provide an example where it is not?

    The answer to another question can be found in the Drools documentation, section 6.5.4.1, Spreadsheet Structure, last paragraph.