Hi Felipe,
Using template you will see that the @{} is replaced "just as is" from the data (for example from a spreadsheet), so
if you have a value in the example will be replaced as text in the rule and you will have something like this:
if @{symbol} == "THE_SYMBOL"
==>rule "A stand alone rule THE_SYMBOL"dialect "mvel"wheneval(THE_SYMBOL == "AAA")thenSystem.out.println("this symbol is" + THE_SYMBOL)end----------
So as you can see, the variable is no more a variable in the generated rule, just text, so if you wanna use it as a string, you should add double-quote
(")
your rule template should be something like this:
rule "A stand alone rule @{symbol}"dialect "mvel"wheneval("@{symbol}" == "AAA")thenSystem.out.println("this symbol is" + "@{symbol}")end2010/4/22 Stefan Marconi <stefan.marconi@gmail.com>_______________________________________________Hi,just starting using drools and need to use templates but having error messages (described in comments in the code below).I checked the meaning of the error messages but still can't figure it out.I modified an simple rule according to the template section of the drools manual: btw I use the eclipse with the drools-core plugin.Thanks for your help. Stefantemplate headersymbolpackage com.test.processor; # [ERR 102] Line 4:26 mismatched input ';' expecting 'identifier' in template headertemplate "test"rule "A stand alone rule @{symbol}"dialect "mvel"wheneval(@{symbol} == "AAA")thenSystem.out.println("this symbol is" + @{symbol})endend template # Multiple markers at this line# - [ERR 103] Line 13:0 rule 'rule_key' failed predicate: {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule# - [ERR 101] Line 13:4 no viable alternative at input 'template' in rule end
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
-----------------------------
Felipe Piccolini
felipe.piccolini@gmail.com
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users