[rules-users] modify and update is not working in the rule file

Wolfgang Laun wolfgang.laun at gmail.com
Thu Aug 16 04:37:52 EDT 2012


See inline:

On 15/08/2012, Rana <ven12344 at yahoo.com> wrote:
> Please let me know what is the problem in this. It does not update the
> values
> when I get the values, it gives me null in my unit test method.

Any stack trace?

>
>
> rule "Drug Strength" extends "Provider State"
> 	no-loop true
> 	dialect "mvel"
> 	agenda-group "AndroGel"
> 	when
> 		Drug( $drug.getStrength == "20.25 mg/1.25 gram (1.62 %)" )

Do you have a field "$drug" in class Drug? Otherwise $drug isn't
defined, and this
rule should not compile at all.

> 		$p : Program()
> 	then
> 		#drools.getWorkingMemory().setGlobal("boolDrugStrength", true )
> 		modify( $p) {
> 			setProgramId( "610.contentId at samplemd.com" ),
> 			setProgramName( "AndroGel 1.62% Savings Card" )
> 		};
> 		update( $p )

This is redundant because modify() does an update anyway.
-W

> 		#retract( $p )
> 		#retract( $drug )
> 		log.info("Prgram ID and Program Name is set for program Coupon for
> Androgel");
> 		#drools.halt();
> end
>
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list