如何在 adf 中使用 groovy 表达式显示最大值

How to display Max using groovy expression in adf

我需要找到最高薪水并在新属性中显示。

员工 table 有以下列:

  Id,
  Name,
  Salary

我使用 Edit Expression Editor 添加了带有 groovy 表达式的新瞬态变量:

    max(Salary) 

显示整个table中存在的最高工资。

我已经在 11g 中尝试过这个例子。

Table : Emp :

    E_ID    EMP_NAME    E_SAL
     2         emp2     5000000
     4         e5       100000
     5         emp2     300000
     6         emp3     250000
     7         emp3     100000
     8         emp3     100000
     3          eee     250000
     1          emp     100000

其中 E_ID - 2 的最高工资为 5000000。

现在回到 ADF:

我已经创建了 EMP table EO 和 VO。

 EMPEO
 EMPVO - EmpView

现在在 EmpView 中拥有 Eid、EmpName、Esal 等所有属性。

在 EmpView 中创建了相同 VO (EmpView) 的 ViewAccessor

     - Click on EmpView.

     - Go to View Accessor. Click on Green plus symbol. Add the EmpView from left to right. It will be named as EmpView1.
  • 创建一个名为 maxSal 的瞬态变量。给出一个groovy表达式 在表达式组件中添加它。

     EmpView1.max("Esal")
    
  • 现在,创建一个 jsff 页面并将 EmpView 添加为表单或 table(根据您的 要求)与新创建的瞬态变量。 运行 应用。它在我的案例中有效。

希望这可能有所帮助。