Jump to: navigation, search

函数编辑器

使用函数编辑器来开发可从规则操作和条件中调用的 Java 方法。

每个函数包含相同的字段:

函数名称—函数的名称

说明—函数的简要说明。

实施—Java 或 Groovy。


示例

此函数用于比较日期。可以按以下方式配置:

Name: compareDates
Description: This function is required to compare dates.
Implementation: 
import java.util.Date;
import java.text.SimpleDateFormat;

function int _GRS_compareDate(String a, String b) {
            // Compare two dates and returns:
            // -99 : invalid/bogus input
            //  -1 : if a < b
            //   0 : if a = b
            //   1 : if a > b
            
            SimpleDateFormat dtFormat = new SimpleDateFormat(“dd-MMM-yyyy”);
            try {
                  Date dt1= dtFormat.parse(a);
                  Date dt2= dtFormat.parse(b);
                  return dt1.compareTo(dt2);
            } catch (Exception e) {
                  return -99;
            }
      }

对于用户提供的类,.jar 文件都必须位于 GRAT 和 GRE 的 CLASSPATH 中。

This page was last edited on November 22, 2019, at 09:40.
Comments or questions about this documentation? Contact us for support!