Hi Faizan,

Two options would be:
global Item newOrderItem

rule "grouped item exists"
       when
               $gi : GroupedItem($i : itemId -> ($i.equals(
newOrderItem.getItemId())))
       then
end

or

rule "grouped item exists"
       when
               $newOrderItem : Item($itemId : itemId)
               $gi : GroupedItem(itemId == $itemId)
       then
end

Steve

On 12/18/06, Faizan <[EMAIL PROTECTED]> wrote:


I'm evaluating Drools-3 for my project.
I have a small drools-2 based application where I used to put an object of
Type "Item" into the working memory as an application data and then do the
comparison with the asserted object of type "GroupedItem" using:

        <application-data
identifier="newOrderItem">Item</application-data>
        <rule name="grouped item exists">
                <parameter identifier="gi">
                        <java:class>GroupedItem</java:class>
                </parameter>

<java:condition>gi.getItemId().equals(newOrderItem.getItemId
())</java:condition>
                <java:consequence>
                                              some code......
                </java:consequence>
        </rule>

I want to do the same using drools-3 and .drl file. Can i use globals here
to do the comparison, like below ?

global Item newOrderItem

rule "grouped item exists"
        when
                                $newOrderItem : Item($itemId : itemId)
                $gi : GroupedItem(itemId == $itemId)
        then
end

Whatever parameter that we declare in "when" condition, could point to an
asserted object as well as the Globals ?
Shouldnt the static information be supplied as application-data/global ?
--
View this message in context:
http://www.nabble.com/ApplicationData-Globals-usage-in-when-condition-in-drools-3-tf2838989.html#a7926365
Sent from the drools - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email




--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference

Reply via email to