天天看點

[BRF+] 測試ruleset

使用昨天report 建立的ruleset,裡面包含了兩個ruleset variable, 這兩個rule variable的初始化分别由calc. cust. discount和calc. pro. discount這兩個decision table來完成。

[BRF+] 測試ruleset

Decision table的rule 維護如下:

如果customer是“sap”,item是“ballpen”,則customer discount值為0.15

如果customer是“sap”,item是“pencil”,則customer discount值為0.12

如果不滿足以上兩個條件,則無discount

這裡的column customer, item和Customer Discount都是function的context裡定義的變量。

[BRF+] 測試ruleset

點選Simulation button:

[BRF+] 測試ruleset

選擇Interpretation Mode:

[BRF+] 測試ruleset

點Execute button.

[BRF+] 測試ruleset

因為customer=sap, item=pencil, 滿足decision table裡的entry,是以customer_discount為0.12

[BRF+] 測試ruleset

promotion=sun, item = pencil, 不滿足decision table裡的任何一條entry,是以promotion_discount為0.

是以rule裡的if 條件不滿足,是以price将按照customer discount進行計算: final price = 10 / ( 1 + 0.12 ) = 8.93

[BRF+] 測試ruleset

如果使用"Execute and Display Processing Steps", 能夠看到BRF+ 每一步具體的執行步驟:

[BRF+] 測試ruleset

繼續閱讀