you are close ;)
From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Michael Neale
Sent: 04 April 2007 05:18
To: Rules Users List
Subject: Re: [rules-users] Need DRL authoring Help
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@gxs.com <John.Tal@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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users