I wan't to match a value (String) of an jess-object and the comparative value is a combination of a string and another field.
Here a simple ("runnable") example:
(defclass Person (is-a :THING) (slot name (type string)) (slot email (type string)))
(mapclass Person)
(make-instance Andy of Person (name "Andy") (email "Andy@mail"))
(defrule search
(object (OBJECT ?tmpPerson)
(is-a Person)
(email (str-cat (slot-get ?tmpPerson name) "@mail"))
)
=>
(print t "found")
)
But the code doesn't compile in JessTab. It seems, that after the field-name "name" the "(" isn't allowed.
Error:
Jess reported an error in routine Jesp.parsePattern.
Message: Bad slot value at token '('.
Program text: ( defrule search ( object ( OBJECT ?tmpPerson ) ( is-a Person ) ( name ( at line 5.
How can I fix this?
Thanks in advance
To match a pattern to the value returned by a function, you have to precede the function call with an equals sign -- i.e., "(name =(str-cat ..."