When in the when (he heee) do you want to call it? The only places are in
an eval, or predicate or return value... I am not sure if they are allowed
in there by design.
On 4/4/06, Paul Smith [EMAIL PROTECTED] wrote:
I don't seem to be able to call functions from within the 'when' clause of
a
my mistake, you should be able to call it, there are a fair few integration
tests that cover that (Mark tells me).
On 4/4/06, Michael Neale [EMAIL PROTECTED] wrote:
When in the when (he heee) do you want to call it? The only places are
in an eval, or predicate or return value... I am not
I was basically trying a few different constructs but the following is not
valid:
package testing
import testing.AddressDetail
expander crm.dsl
function void doSomething(String s) {
System.out.println(s);
}
rule MandatoryStreet1AddressNotNull
when
The first street address
OK,
modified the function to read
function boolean doSomething(String s) {
System.out.println(s);
return true;
}
and the .dsl file to read
eval(doSomething({s}) == true);
but we get
org.drools.rule.InvalidRulePackage: Rule Compilation error The method
eval(boolean) is undefined for
should just be eval(doSomething())
as long as doSomething returns true, should be OK.
On 4/4/06, Paul Smith [EMAIL PROTECTED] wrote:
OK,
modified the function to read
function boolean doSomething(String s) {
System.out.println(s);
return true;
}
and the .dsl file to read
That's what I tried initially and got the same result. It's actually
eval(doSomething({s}))
On 4/4/06, Michael Neale [EMAIL PROTECTED] wrote:
should just be eval(doSomething())
as long as doSomething returns true, should be OK.
On 4/4/06, Paul Smith [EMAIL PROTECTED] wrote:
OK,
Can you make an integration tests that fails?
So far we have:
http://anonsvn.labs.jboss.com/trunk/labs/jbossrules/drools-compiler/src/test/resources/org/drools/integrationtests/test_FunctionInConsequence.drl
Will do. Thanks
On 4/4/06, Michael Neale [EMAIL PROTECTED] wrote:
to eliminate layers, can you manually expand it, and make sure it fails
the
same? Also, there is a test_EvalException that shows a function call in a
eval - I wonder what the difference is as to why that one works.
Finally,
no thats OK. Perhaps you might want to write it up on the wiki ??? ;)
Yes, re my previous email, if there is a need to put it on the LHS and the
RHS, on the LHS an extra expression will be needed to wrap the eval() around
it.
On 4/4/06, Paul Smith [EMAIL PROTECTED] wrote:
I've worked it out.