you can keep a flag to check if it isNew or isEmpty flag inside the Object
and check this flag inside your rule. Or add a method checkNull() to the
object and check this method in the rule file.
rule "otherwise"
when
$p : Person( isNew == true )
then retract ($p)
end
Hope this works !!! :)
Bin Shen (BA/EDD) wrote:
but, u haven't answered my question.
i see the grouped hidden lines in the example.
i use yr terms. the condition ("snippet" in my term) can not be empty, and
the action ("cell" in my term) can be empty. in my case how should i put
the condition, when no field constraint is there? how should i put in the
action? an empty makes the condition not applicable!
the case i raised seems trivial. actually it finds many applications as
follows.
rule "main"
salience 10
when
$p : Person(age > 35)
then
// do something with persons older than 35
System.out.println("hello, " + $p + "!");
end
rule "otherwise"
when
$p : Person()
then
// ignore other persons, i.e. retract them to avoid memory leaks
retract($p);
end
/ Ben
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Manjax23
Sent: Donnerstag, 16. August 2007 15:53
To: rules-users(a)lists.jboss.org
Subject: [rules-users] RE: trivial case in xls
http://downloads.jboss.com/drools/docs/4.0.0.13773GA/html_single/index.ht...
Condition and action cell should not be null and should contain valid
data.
If you could see a small plus sign, expand it.you should be able to see
the parameters that are passed to the rule, and both the condition and
action snippets.
And the data set you are comparing against can be empty.
Hope this works for you :)
Thanks,
Manjax23
Bin Shen (BA/EDD) wrote:
>
> hi, Manjax,
>
> have studied the example that u mentioned.
>
> take the schema as follows:
> object type $p : Person
> snippet ?
> cell ?
>
> i mean a special case when there is no field constraint at all. if i
> leave out the snippet. some runtime error said that the script is null
> :((
>
> can u tell me what should i put in snippet and cell respectively. thanx!
>
>
> / Ben
>
>
> -----Original Message-----
> From: rules-users-bounces(a)lists.jboss.org
> [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Manjax23
> Sent: Donnerstag, 16. August 2007 14:53
> To: rules-users(a)lists.jboss.org
> Subject: Re: [rules-users] trivial case in xls
>
>
> Download the example.zip and there is a sample "ExamplePolicyPricing.xls"
> and PricingRuleDTExample.java.
>
> :) pls read documentation :)
>
>
> Bin Shen (BA/EDD) wrote:
>>
>> Hi, all,
>>
>> use 4.0.0 GA.
>>
>> want to have an xls rule file. i am not sure of how to define the
>> following trivial case in xls.
>>
>> can anybody help? thanx!
>>
>> when
>> $p : Person()
>> then
>> // do something with any person
>> end
>>
>>
>> / Ben
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> --
> View this message in context:
>
http://www.nabble.com/trivial-case-in-xls-tf4279398.html#a12180689
> Sent from the drools - user mailing list archive at
Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
View this message in context:
http://www.nabble.com/trivial-case-in-xls-tf4279398.html#a12181827
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users