I assume your DRL contains<br> global String ndc11<br><br>Assigning to this variable must be done using kSession.setGlobal(...).<br><br>In the DRL, you can access it by using variable name ndc11.<br><br>In Java code, you must used kSession.getGlobal(...).<br>
<br>That you can do in a consequence<br> ndc11 = ...;<br>is regrettable; it is to be hoped that this can be plugged at some future time.<br><br>-W<br><br><br><div class="gmail_quote">On 26 May 2011 17:33, sdinoo <span dir="ltr"><<a href="mailto:sdinoo@gmail.com">sdinoo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I have a rule flow that has two tasks that insert global value called ndc11<br>
<br>
<br>
In the ProcessTest.java (using the sample program) I am trying this code<br>
ksession.startProcess("com.drughistory");<br>
ksession.fireAllRules();<br>
NdcMaster myNdc = (NdcMaster)ksession.getGlobal("ndc11");<br>
System.out.println(">>>>>>" + myNdc.getNdc11()); //THIS IS LINE 53<br>
<br>
CONSOLE OUTPUT<br>
Inserted drug with ABCDEFGH<br>
Found Global ABCDEFGH<br>
java.lang.NullPointerException<br>
at rules.tester.ProcessTest.main(ProcessTest.java:53)<br>
<br>
All I want to do is access the inserted object and use the same - Can<br>
someone please help?<br>
<br>
<br>
DROOLS FILE<br>
rule "getDrugMaster" ruleflow-group "DUR" dialect "java" salience 100<br>
when<br>
dc: DurClaim( )<br>
then<br>
ndc11 = ClaimsHistoryHelper.getClaimDrugRecord(dc.getProductSvcID());<br>
insert(ndc11);<br>
System.out.println("Inserted drug with " + ndc11.getNdc11());<br>
<br>
end<br>
<br>
rule "Get History Claims" ruleflow-group "getClaimHistory" dialect "java"<br>
salience 99<br>
when<br>
n: NdcMaster( ndc11 == "ABCDEFGH" )<br>
then<br>
insert(ndc11);<br>
System.out.println("Found Global " + n.getNdc11());<br>
end<br>
<font color="#888888"><br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Accessing-globals-after-FireAllRules-tp2989144p2989144.html" target="_blank">http://drools.46999.n3.nabble.com/Accessing-globals-after-FireAllRules-tp2989144p2989144.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>