[rules-users] Decision Table column testing for exists

Herman Post Herman.Post at imail.org
Thu Jun 21 15:42:14 EDT 2012


Thanks Wolfgang, that makes sense.


Herm

-----Original Message-----
From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Wolfgang Laun
Sent: Thursday, June 21, 2012 12:53 AM
To: Rules Users List
Subject: Re: [rules-users] Decision Table column testing for exists

As an alternative that avoids the unnecessary counting of FeV1,
consider adding a helper fact type and a couple of (DRL) rules.

declare Existence
   value: boolean
end

rule not2exists
when
    exists FeV1()
    $e:  Existence( value == false )
then
    modify( $e ){ setValue( true ) }
end

rule exists2not
when
    not FeV1()
    $e:  Existence( value == true )
then
    modify( $e ){ setValue( false ) }
end

Insert one Existence fact. The decitions table condition should be self-evident.

-W


On 21/06/2012, Wolfgang Laun <wolfgang.laun at gmail.com> wrote:
> n:Number((n.intValue()>0)==$param) from accumulate( FeV1(), count(1) )
>
> -W
>
> On 20/06/2012, Hrumph <Herman.Post at imail.org> wrote:
>> Hi.   I'm trying to figure out how to express a Condition that does the
>> following:
>>
>> Column name:   FeV1 exists
>> Possible values:   true, false, n/a
>>
>> I wish to test for the existence of an FeV1 fact and have a different
>> condition in the rule generated, as follows:
>>
>> true, generates 'exists FeV1()'
>> false, generates 'not FeV1()'
>> n/a, generates nothing
>>
>> Is there some way to do this?
>>
>> Thanks,
>>
>> Herm
>>
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Decision-Table-column-testing-for-exists-tp4018115.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



More information about the rules-users mailing list