[rules-users] Adding an optional condition without using eval()

Enda J Diggins ejdiggins at gmail.com
Thu Mar 4 10:04:27 EST 2010


Hi Daniel,

Put the reference in a comment and be careful where you put your commas!

$current:Claim(historic= false, ...)
$historic:Claim(historic==true, ...
                      , $current.doc == $history.doc // @{CHECK_DOCTOR}
                      )

If you're trying to do what I think you're trying to do, the above should
work :)
When there is no value in the CHECK_DOCTOR field, the entire line:

                           , $current.doc == $history.doc // @{CHECK_DOCTOR}

will not be included and the rule will look like the following:

$current:Claim(historic= false, ...)
$historic:Claim(historic==true, ...
                      )

Which is fine.

Hope it helps,

Enda

On Tue, Mar 2, 2010 at 12:36 PM, djb <dbrownell83 at hotmail.com> wrote:

>
> Hi,
>
> My rule template project is finally working, more-or-less.
>
> I've got 5 lines of conditions, the last 2 of which are evals.  One of them
> compares dates, and has to be an eval().  The other though, I think I
> should
> be able to convert to non-eval DRL, but I am not sure how, because it is an
> optional condition.
>
> So, I've got
> $current:Claim(historic==false, ...)
> $historic:Claim(historic==true, ...)
> eval($current.hasSameDoctor($historic,"@{CHECK_DOCTOR}"));
>
> so, the line disappears if @{CHECK_DOCTOR} is blank, which is what I want.
> I want something like, eval($current.doc == $historic.doc)
> but i only want to check this if @{CHECK_DOCTOR} is "Y".
>
> Is there any way to do this check without an eval?
>
> Regards,
> Daniel
>
> --
> View this message in context:
> http://n3.nabble.com/Adding-an-optional-condition-without-using-eval-tp423886p423886.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
Enda J Diggins
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100304/2885f301/attachment.html 


More information about the rules-users mailing list