1

I am getting issue when i use ! along with drools string operations like matches, str[startsWith] . Any idea why drools doesn't allow ! with operators like matches , not matches, str[startsWith], str[endsWith], length

The ! works for other operators like == , < ,> .

Drl with exception :

package example

import com.Customer

rule "sample rule"

no-loop true

dialect "mvel"

when

   $customer:Customer!(state == "CA" && city str[startsWith] "TOP")

then

    System.out.println("Do something" );

end

Error Message : [ERR 102] Line 11:19 mismatched input '!' in rule "sample rule" in pattern]

Drl without exception:

package example

import com.Customer

rule "sample rule"

no-loop true

dialect "mvel"

when

   $customer:Customer!(state != "CA" && city != "TOP")

then

    System.out.println("Do something" );

end

Drools should be able to validate the below drl without any issues, package example

import com.Customer

rule "sample rule"

no-loop true

dialect "mvel"

when

    $customer:Customer!(state == "CA" && city str[startsWith] "TOP")

then

    System.out.println("Do something" );

end
Khwaja Sanjari
  • 455
  • 5
  • 17

0 Answers0