如何获取 Progress4GL 上每个语句的表中的最后一项

Kyl*_*yle 1 for-loop progress-4gl

for each在使用语句和 using来迭代表后,我一直试图获取表的最后一项last-of,但它获取的是所有项目,而不是仅获取最后一项。这需要在 a 内完成,因为我正在使用数据for each填充网站模板( )。.tpl

表格

table有两项

这是我的理论代码

for each table no-lock 
    break by table.tab-code.

    if last-of (table.tab-code)
    then do:
       disp "last one".
    end.
    else do:
       disp "not the last one".
    end.
end.
Run Code Online (Sandbox Code Playgroud)

输出:

last one

last one
Run Code Online (Sandbox Code Playgroud)

Scr*_*ape 5

Last-of 将为您提供 table.tab_code 每个值的最后一个实例,因此如果您有三个不同的值,它将测试每个不同值的最后一个实例。

您正在寻找的只是

if last(table.tab-code)
Run Code Online (Sandbox Code Playgroud)