[rules-users] Need DRL authoring Help

Michael Neale michael.neale at gmail.com
Wed Apr 4 00:18:18 EDT 2007


you are close ;)

Yes, it is a challenge, thats what the examples are for etc.

but try this (FYI I think you mean "or"):

*rule* "UCCnet_DVE_Depth_All"

      *when*

            catalogObject : CatalogObject( )

         eval( catalogObject.getElementValue("depth") == *null* ||
catalogObject.getElementValue("depth") == "" )

#           String depth = CatalogObject.getElementValue("depth")

#           depth == null

#           depth == ""

#           catalogObject : CatalogObject( depth == null)

#           catalogObject : CatalogObject( depth == "")

      *then*

           # DON'T do this            logWriter : LogWriter();

        # BUT you can pass in a logWriter global variable

            logWriter.logDebug("Package Depth is Blank");

            System.out.println( "Package Depth is Blank" );
*end*


Hope that helps.
In the up coming BRMS, there will be a GUI which also has a secret purpose
of "coaching" what DRL looks like, for those who need to know.

On 4/4/07, John.Tal at gxs.com <John.Tal at gxs.com> wrote:
>
>  Writing DRL is not easy for people new to drools.   Can someone please
> help me understand how to write this simple rule?  You can see the
> approaches I have taken.
>
>
>
> In this case I do not have getters and setters for the attributes I am
> checking.  I need to pass parameters to the object for it to get the data.
>
>
>
> I can't get any of the code in the when block to be syntax proper.
>  Existing DRL doc is lacking in this area.
>
>
>
> Thanks  John
>
>
>
>
>
> *rule* "UCCnet_DVE_Depth_All"
>
>       *when*
>
>             catalogObject : CatalogObject( getElementValue("depth") == *
> null*, getElementValue("depth") == "")
>
> #           String depth = CatalogObject.getElementValue("depth")
>
> #           depth == null
>
> #           depth == ""
>
> #           catalogObject : CatalogObject( depth == null)
>
> #           catalogObject : CatalogObject( depth == "")
>
>       *then*
>
>             logWriter : LogWriter();
>
>             logWriter.logDebug("Package Depth is Blank");
>
>             System.out.println( "Package Depth is Blank" );
>
> *end*
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070404/94041c6d/attachment.html 


More information about the rules-users mailing list