javadroolsdrools-guvnor

While reading Drools Drt with some empty values in excel file, The condition part in rule gets disappear for the Empty Values


While running Drools DRT with some empty values in excel file gives an error .

This is the rule which we have used....

rule "Rule1_@{row.rowNumber}"

when
      variable:Fact(("All"=="@{Column1}" || ("Gold"=="@{Column1}" && @{Column2} == 
      GoldId) || ("Silver"=="@{Column1}" && @{Column2} == SilverId)) && 
      ("All"=="@{Column3}" || ("Diamond"=="@{Column3}" && @{Column4}== DiamondId) || 
      ("Platinum"=="@{Column3}" && @{Column4}== PlatinumId)) && ("@{Column5}" == 
      Column5) && ("@{Column6}" == Column6))
then
      list.add(@{Column7}+"@{Column8}");
end

And this is data which has been provided through excel sheet.

Data file(Excel file)

When the cell in Excel is not empty the rule we get is this and its the rule which we want.

rule "Rule1_1"

when
      variable:Fact(("All"=="Gold" || ("Gold"=="Gold" && 10 == GoldId) || 
      ("Silver"=="Gold" && 10 == SilverId)) && ("All"=="Platinum" || 
      ("Diamond"=="Platinum" && 15== DiamondId) || ("Platinum"=="Platinum" && 15== 
      PlatinumId)) && ("GoldPlatinum" == Column5) && ("Discount" == Column6))
then
      list.add(2+"Customer");
end

but when the cell in excel is empty, for example:Column1=All;Column2=empty;Column3=Diamond;Column4=9 and so on from first row of excel sheet.

the rule generated is this...

rule "Rule1_2"

when
      //Here it shows nothing
      //only for this part it is full empty because of empty value in excel cell
then
      list.add(1+"Customer");
end

the condition part gets disappeared when the value for specific parameters gets empty. Just like in this case the the value in Column3 was empty.

Is there any solution where we can run DRT file with an empty cell in excel file.


Solution

  • Trying using ${Column} instead of @{Column}, it should resolve the problem.