droolsdrools-guvnordrools-flow

While reading Drools Drt with some given Parameters, The condition part in rule gets disappear for the Empty Values as well as for Empty String


While running Drools DRT with some empty values 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

When the parameter 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 parameter is null or Empty String, for example:Column1=All;Column2=empty or Empty String("");Column3=Diamond;Column4=9.

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 or Empty String. Just like in this case the the value in Column3 was empty as well as for Empty String.

Is there any solution where we can run DRT file with an empty String in Parameters.


Solution

  • The issue was we were giving @parameter instead of @ there should be $. And when we use $ it works absolutely fine.