流浪汉的变种

时间:2019-03-28 10:56:43

标签: drools

在规则2中无法使用该变量的情况下,在规则1中设置了相同变量的值,该规则在执行规则2之前触发。

rule "Rule1"
no-loop true
lock-on-active true
salience 1000
    when 
        $ExeMode: Module( event.type in ("summer", "spring"))
    then
        $ExeMode.getEvent().setStatus("Available");
        System.out.println($ExeMode.getEvent().getStatus());
        update($ExeMode);


rule "Rule2"
no-loop true
lock-on-active true
salience 999
    when 
        $Mod: Module( event.status in ("Available", "NotAvailable"))
    then
        $Mod.getEvent().setResult("Booked");


状态变量在rule1中设置,并能够在其中打印值。

当我使用与Rule2中的condition相同的变量时。则Rule2不触发。 请提出建议。

1 个答案:

答案 0 :(得分:0)

您在规则中使用Option Explicit Option Compare Text 'ignore case sensitivity when comparing strings Sub Permits() Dim OL As Outlook.Application, ES As Worksheet, _ r As Long, i As Long, WB As ThisWorkbook Set WB = ThisWorkbook Set ES = WB.Sheets("Permits") Set OL = New Outlook.Application r = ES.Cells(Rows.Count, 1).End(xlUp).Row For i = 2 To r With ES.Cells(i, 10) If .Value = "Yes" And .Offset(0, 1).Value <> "Yes" Then .Offset(0, 1).Value = "Yes" With OL.CreateItem(olAppointmentItem) .Subject = ES.Cells(i, 3).Value .Start = ES.Cells(i, 7) + ES.Cells(i, 8).Value .ReminderSet = True .ReminderMinutesBeforeStart = 60 .Body = "£" & ES.Cells(i, 6).Value .Save End With End If End With Next i Set OL = Nothing Set WB = Nothing Set ES = Nothing End Sub 属性,这意味着规则的RHS不会触发新的激活。

希望有帮助,