0

我有一个查询:

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) 

如何为“break by”设置变量?

4

1 回答 1

1

查找“查询准备”。这就是让您完全自定义查询的魔力。

我今天早上碰巧在写这样一个查询:

/* 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”运行上面的代码。

于 2013-05-07T21:31:17.677 回答