u almost had it. This should do it.
Subscriber($age : age)
Campaign($campaignAgeRangs : listOfAgeRangeCodes)
AgeRange(minAge <= $age, max >= $age, code memberOf $campaignAgeRangs)
As far as performance, i would think the former would be faster. This one
will look at all campaigns regardless if they have an AgeRange that matches.
The former just looks for an AgeRange, then joins back to the Campaign.
dave
On Sun, Dec 21, 2008 at 2:18 PM, Maxim Veksler <maxim.veksler(a)gmail.com>wrote:
Thank you very much for the fast and accurate reply David,
Is it also possible to use the opposite positioning?, something like:
Subscriber($age : age)
Campaign($campaignAgeRangs : listOfAgeRangeCodes)
AgeRange(minAge <= $age, max >= $age, $campaignAgeRangs contains code)
Please don't try the above as this tries to create a field extractor for
$campaignAgeRangs on the AgeRange object which fails for obvious reasons..
I would like to to filter first by Subscriber, then by Campaign and last by
age range. This is obviously a simplification of the actual filtering rules.
On Sun, Dec 21, 2008 at 7:28 PM, David Sinclair <
dsinclair(a)chariotsolutions.com> wrote:
> Subscriber($age : age)
> AgeRange(minAge <= $age, max >= $age, $code : code)
> Campaign(listOfAgeRangeCodes contains $code)
>
> On Sun, Dec 21, 2008 at 12:17 PM, Maxim Veksler
<maxim.veksler(a)gmail.com>wrote:
>
>> Hello,
>>
>>
>> The dataModel is as following:
>>
>> class AgeRange() {
>> Integer code;
>> int minAge;
>> int maxAge;
>> }
>>
>> Campaign() {
>> List<Integer> listOfAgeRangeCodes;
>> }
>>
>> Subscriber() {
>> int age;
>> }
>>
>> AgeRange()'s and Campaign()'s are pre-populated into the WM.
>> Subscriber() is asserted right before fireAllRules is called.
>>
>> I need a rule that would allow me to check if Subscriber() is within one
>> of the defined on the Campaign() AgeRange()'s.
>>
>> What would be the most efficient way to enforce this constraint?
>> The other possibility I see is to store the list of AgeRange()'s in each
>> Campaign() and then use eval() to iterate over the list...
>>
>>
>> Advice and ideas are appreciated.
>>
>>
>> Thank you,
>> Maxim.
>> --
>> Cheers,
>> Maxim Veksler
>>
>> "Free as in Freedom" - Do u GNU ?
>>
>> _______________________________________________
>> 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
>
>
--
Cheers,
Maxim Veksler
"Free as in Freedom" - Do u GNU ?
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users