<br> Karthizap,<br><br> The only thing I could think of for you is to use a function in the DRL to store your "name" value, but any solution where you change your DRL will require you to redeploy the DRL file (obviously).<br>
<br> Since your "name" changes quite often, can't you make it a fact of your reasoning process? Just to keep with the "Person" theme, make a helper class called AssignedName or something like that and do:<br>
<br>when<br> AssignedName( $an : name )<br> Person( name == $an )<br>then<br>end<br><br> This will even prevent re-deployments of the DRL itself. Also, a join like the above has cost O(1), so extremely good perf also (better than a function call).<br>
<br> Drools does not support constants declaration in the DRL file, as you know, but maybe this is something we could add. Do you want to open a JIRA with a feature request for that? (That would still require DRL redeployment discussed above, obviously).<br>
<br> Edson<br><br> <br><br><div class="gmail_quote">2009/6/1 karthizap <span dir="ltr"><<a href="mailto:karthizap@gmail.com">karthizap@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Thanks for your reply Earnie. In the following example, don't want to<br>
hardcode Person Name value like "John" in the DRL file. I want to refer it<br>
from some other sources(If i refer it from java class file, name value is<br>
getting changed quiet often, have to recompile the java source and deploy).<br>
My main requirement is, if the name value is getting changed, don't want to<br>
redeploy/restart the application. i would like to do the changes in the drl<br>
file only without hard coding.<br>
<br>
<br>
rule "Test Rule"<br>
<br>
when<br>
$person : Person( name == "John")<br>
then<br>
$person.setActivation(true)<br>
<br>
end<br>
<br>
Karthikeyan<br>
<br>
Please explain, how i can refer global object in LHS?<br>
<div><div></div><div class="h5"><br>
<br>
Earnie D wrote:<br>
><br>
> How about adding them as Globals and referencing them that way? You should<br>
> be able to put them in a map as well in a Global and reference them.<br>
><br>
> Earnie!<br>
><br>
><br>
><br>
><br>
> ________________________________<br>
> From: karthizap <<a href="mailto:karthizap@gmail.com">karthizap@gmail.com</a>><br>
> To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> Sent: Monday, June 1, 2009 7:14:56 AM<br>
> Subject: re[rules-users] move hardcoded values in DRL or have constants<br>
> inside drl<br>
><br>
> Is there is anyway i can remove hardcoded values in the DRL file? Can I<br>
> have the constants file(like data dictionary) inside drl/functions. I<br>
> don't want to refer java constants class directly in drl file and would<br>
> like to declare and refer those constants inside drl file.<br>
> ________________________________<br>
> View this message in context: remove hardcoded values in DRL or have<br>
> constants inside drl<br>
> Sent from the drools - user mailing list archive at Nabble.com.<br>
><br>
</div></div>> _______________________________________________<br>
> rules-users mailing list<br>
<div class="im">> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
</div><div class="im">> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
><br>
<br>
</div>--<br>
View this message in context: <a href="http://www.nabble.com/remove-hardcoded-values-in-DRL-or-have-constants-inside-drl-tp23813412p23814041.html" target="_blank">http://www.nabble.com/remove-hardcoded-values-in-DRL-or-have-constants-inside-drl-tp23813412p23814041.html</a><br>
<div class="im">Sent from the drools - user mailing list archive at Nabble.com.<br>
<br>
</div>_______________________________________________<br>
rules-users mailing list<br>
<div class="im"><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
</div><div><div></div><div class="h5"><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>