Hi Felipe, thank you for bearing with me.
actually I put an eval() there just to have something as simple as possible(but couldn't be sure it it worked). I actually found a hello world example which works fine without being template and which I will now try to transform it into template form. I suspect I'm not passing parameter correctly, somehow. I will unfortunately be away for the next 10 days, so will revert only later and hopefully on a better example than my original. Thanks. Stefan 2010/4/27 Felipe Piccolini <[email protected]> > Im not sure if you can find a complete standalone example for this, but I > think your problem now is with eval(). > > Can you copy your stackTrace here? > > I think you can not do eval( literal == literal), > but you could make a function to test that if you wanna use eval and give > the function the value of @{symbol} > > > 2010/4/27 Stefan Marconi <[email protected]> > > Hi Felipe, >> >> thank you for your reply. I have now added the extra quotes but to no >> avail. I still get the same errors. >> >> Is there somewhere a stand-alone example with the compile instructions to >> check that everything works? I have the impression that I'm having troubles >> with the whole eclipse config and plugin. >> >> Thanks! Stefan >> >> >> 2010/4/26 Felipe Piccolini <[email protected]> >> >> 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" >>> when >>> eval(THE_SYMBOL == "AAA") >>> then >>> System.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" >>> when >>> eval("@{symbol}" == "AAA") >>> then >>> System.out.println("this symbol is" + "@{symbol}") >>> end >>> >>> >>> >>> >>> 2010/4/22 Stefan Marconi <[email protected]> >>> >>>> 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. Stefan >>>> >>>> template header >>>> symbol >>>> >>>> package com.test.processor; # [ERR 102] Line 4:26 mismatched input ';' >>>> expecting 'identifier' in template header >>>> template "test" >>>> rule "A stand alone rule @{symbol}" >>>> dialect "mvel" >>>> when >>>> eval(@{symbol} == "AAA") >>>> then >>>> System.out.println("this symbol is" + @{symbol}) >>>> end >>>> end 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 >>>> [email protected] >>>> https://lists.jboss.org/mailman/listinfo/rules-users >>>> >>>> >>> >>> >>> -- >>> ----------------------------- >>> Felipe Piccolini >>> [email protected] >>> >>> _______________________________________________ >>> rules-users mailing list >>> [email protected] >>> https://lists.jboss.org/mailman/listinfo/rules-users >>> >>> >> >> _______________________________________________ >> rules-users mailing list >> [email protected] >> https://lists.jboss.org/mailman/listinfo/rules-users >> >> > > > -- > ----------------------------- > Felipe Piccolini > [email protected] > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > >
_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
