进度4GL查询,可选“突破”

时间:2013-05-07 17:28:09

标签: break progress-4gl

我有一个问题:

for each a where ...,
    each b where ...,
    each c where ...,
      break by c.xxx by c.yyy by c.zzz.

我需要根据用户输入的不同而改变。

当我尝试定义查询时:

def query qa for a, b, c. 
if ... then open qa for each a... (as above)

然后它将无法编译,因为:

BREAK requires query be defined SCROLLING. (14283) 

如何为“突破”设置变量?

1 个答案:

答案 0 :(得分:1)

查找“query-prepare”。这是让您完全自定义查询的神奇之处。

今天早上我碰巧写了这样一个问题:

/* dyn.p
 */

define variable tbl as character no-undo.
define variable brk as character no-undo.

define variable b   as handle no-undo.
define variable q   as handle no-undo.

tbl = "customer".
brk = "state".

create query  q.
create buffer b for table tbl.

q:set-buffers( b ).

q:query-prepare( "for each " + tbl + " break by " + brk ).
q:query-open.
q:get-next().

do while q:query-off-end = false:

  if q:first-of( 1 ) then clear all.

  display
    b:buffer-field( 'CustNum' ):buffer-value()
    b:buffer-field( 'Name'    ):buffer-value()
    b:buffer-field( 'State'   ):buffer-value()
   with
    down
  .

  down 1.

  q:get-next().


end.

return.

针对“sports2000”运行上面的代码。