package com.example.drools;
global Integer count; // I want to initialize this count variable with some
default value.
rule "Initialize"
when
then
count= 1; // Locally it's possible but want it to set globally which can
be use in any other rules just simply by calling it.
System.out.println("count="+count);
end
rule "Drools Introduction"
when
then
System.out.println("count="+count); // Here output is coming null which in
want some default value set for
global value.
end
所以只想在drl文件中初始化Count变量?
答案 0 :(得分:1)
从规则内部更新全局变量的方法是使用自动变量const url = new URL("https://example.com/test")
url.pathname = "/"
console.log(url.toString())
:
kcontext
一些注意事项:
希望有帮助,