0

我正在使用 ilog 规则。我想验证对象数组列表中的字段。

喜欢,

class Company {
    List<Employee> employee;
}

class Employee {
    String Name;
    int age;
}

在这里,我想验证年龄字段不是负数。我将公司对象作为输入参数传递,

definitions
    set 'Company' to 'The Company to validate' ;
    set 'Employees' to employee working for 'Company'

现在我如何迭代作为数组列表的员工并检查年龄验证。

4

1 回答 1

0

使用“in”BAL 构造将集合中的单个员工绑定到定义语句中的变量,然后为该员工编写验证规则。

请参阅您的 IBM ODM 版本的知识中心/信息中心,例如:

IBM Operational Decision Manager 8.6.0>Operational Decision Manager 8.6 版>决策服务器规则>参考>规则设计器参考>规则语言>业务操作语言 (BAL)>BAL 构造>在

您可以尝试以下方法:

definitions 
    set 'employee' to an employee in the employees of 'the company' ; 
if
    the age of employee is less than 0
then
    print "Age of employee " + the name of employee + "' is negative: " + the age of employee ; 
else
    print "Age of employee " + the name of employee + "' is OK: " + the age of employee ; 
于 2014-09-08T11:48:06.353 回答