谁能指导我如何在 Codeeffects RuleEditor 中创建像 SUM()、AVG() 这样的聚合器。这些应该与规则编辑器中的一组整数值一起传递。
就像如果有一个像 score 这样的 int 类型的属性......
规则如下:
如果分数等于零,则将分数设置为 SUM(10,20,30,40)
在这之后应该得到这个分数为100
谁能指导我如何在 Codeeffects RuleEditor 中创建像 SUM()、AVG() 这样的聚合器。这些应该与规则编辑器中的一组整数值一起传递。
就像如果有一个像 score 这样的 int 类型的属性......
规则如下:
如果分数等于零,则将分数设置为 SUM(10,20,30,40)
在这之后应该得到这个分数为100
在源类中定义整数列表:
public List<int> Integers {get;set;}
定义两个动作方法:
public void Sum ( List<int> list )
{
return list.Sum( );
}
public void Add ( int i )
{
this.Integers.Add( i );
}
public int Modulus (int operandOne, int operandTwo)
{
return operandOne % operandTwo;
}
现在将您的类作为规则编辑器的源并创建您的规则:
If Modulus( Score, 2 ) is equal to 3
then
Add(10) and Add(20) and Add(30) and Add(40) and
set Score to Sum ( Integers )