[rules-users] Re: Recursion problem whilc execution of rules
Nirmal.R
rgbnirmal at yahoo.com
Wed Jan 31 01:23:08 EST 2007
initialze the variables with -1 and then assert
add the following to the rules as the first eval condition
rule "gst_rate_ol"
eval(QuoteUpdater . getQuoteLevelGSTRate () == -1 )
rule "NZ_SD"
eval(
QuoteUpdater . getQuoteLevelGSTStreamRate ( ) == -1) ;
QuoteUpdater . getQuoteLevelStampDutyRate ( ) == -1);
QuoteUpdater . getQuoteLevelStampDutyAmount()==-1);
)
rule "gst_stream_rate_ol"
eval(QuoteUpdater . getQuoteLevelGSTStreamRate () == -1);
Tell me if it works
Nirmal
KAPX wrote:
>
> Hi,
>
> I am using drools version 3.0. I have a recursion problem while executing
> a rule.
> Here is the sample code.
>
> import com.thirdpillar.QuoteUpdater
> import java.lang.String
> import java.math.BigDecimal
>
> global BigDecimal TEMP
> global BigDecimal GL_SD_Amt
>
> rule "gst_rate_ol"
> no-loop true
> salience 50
> when
> QuoteUpdater:QuoteUpdater()
> eval(QuoteUpdater.getCustomerTypeCountry().equals("New Zealand") &&
> QuoteUpdater.isFinanceLease() == true ||
> QuoteUpdater.isRental() == true ||
> QuoteUpdater.isOperatingLease() == true ||
> QuoteUpdater.isHirePurchase() == true)
> then
> System.out.println("1");
> TEMP = BigDecimal . valueOf ( 0.125 ) ;
> QuoteUpdater . setQuoteLevelGSTRate ( BigDecimal . valueOf ( TEMP .
> doubleValue ( ) ) ) ;
> modify(QuoteUpdater);
> end
> rule "NZ_SD"
> no-loop true
> salience 45
> when
> QuoteUpdater:QuoteUpdater()
> eval(QuoteUpdater . getCustomerTypeCountry ( ).equals("New Zealand"))
> then
> System.out.println("2");
> QuoteUpdater . setQuoteLevelGSTStreamRate ( BigDecimal . valueOf ( 0 )
> ) ;
> QuoteUpdater . setQuoteLevelStampDutyRate ( BigDecimal . valueOf ( 0 )
> ) ;
> GL_SD_Amt = BigDecimal . valueOf ( 0 ) ;
> QuoteUpdater . setQuoteLevelStampDutyAmount ( BigDecimal . valueOf ( 0
> ) ) ;
> modify(QuoteUpdater);
> end
> rule "gst_stream_rate_ol"
> salience 40
> no-loop true
> when
> QuoteUpdater:QuoteUpdater()
> eval(QuoteUpdater.getCustomerTypeCountry().equals("New Zealand") &&
> QuoteUpdater.isRental() == true ||
> QuoteUpdater.isOperatingLease() == true)
> then
> System.out.println("3");
> TEMP = BigDecimal . valueOf ( 0.125 ) ;
> QuoteUpdater . setQuoteLevelGSTStreamRate ( BigDecimal . valueOf ( TEMP
> . doubleValue ( ) ) ) ;
> modify(QuoteUpdater);
> end
>
> Please help me out to resolve this problem. If you have any solution of
> how to handle it please give your inputs and suggestions.
>
> Regards,
> KAPIL
>
--
View this message in context: http://www.nabble.com/Recursion-problem-whilc-execution-of-rules-tf3146827.html#a8723907
Sent from the drools - user mailing list archive at Nabble.com.
More information about the rules-users
mailing list