从浏览中获取选定的行

时间:2012-09-10 14:03:40

标签: progress-4gl openedge

我正在尝试使用Progress-4gl中的浏览,该浏览将运行一个控制键以显示浏览中所选行的数量,以及所有选定行的临时表中的总数量。我已经能够轻松获得总行数,但是当我尝试从我创建的临时表中获取总数时,它只有最后选择的行值。如何从选定的行中为每个运行一个? 这是我用于浏览的一些代码:

on CTRL-L of browse-1 in frame a do:
   assign buf-cnt = 0.
   /***  FOR EACH BROWSE RECORD SELECTED **/
       assign jqty = jqty + int(tt.tt-qty).
   assign jlines = browse-1:num-selected-rows.
  display
       jlineslabel "Selected Number Of Lines"
       jqtylabel "Quantity Of All Lines"
       with frame fselect down row 5 centered overlay.
  pause.
end. /* on CTRL-L */

2 个答案:

答案 0 :(得分:0)

如果我正确理解了这个问题,你可能想要与浏览相关联的查询句柄的num-results属性 - 这将是browse-1:query。所以:

jqty = browse-1:query:num-results.

答案 1 :(得分:0)

对于任何想知道......

on CTRL-L of browse-1 in frame a do:
 assign buf-cnt = 0
        jqty = 0.
 do x = 1 to browse-1:num-selected-rows:
   stat = browse-1:fetch-selected-row(x).
   for each usrw_wkfl no-lock where
            usrw_wkfl.usrw_key1 = "862" and
            entry(1,usrw_wkfl.usrw_key2) = tt.tt-part and
            usrw_wkfl.usrw_key4 = tt.tt-dest and
            usrw_wkfl.usrw_key3 = tt.tt-duedate and
            usrw_wkfl.usrw_charfld[3] = tt.tt-qty:
      assign jqty = jqty + int(tt.tt-qty).
   end. /* for each usrw_wkfl */
 end. /* do x = 1 to browse-1 */
 assign jlines = browse-1:num-selected-rows
        jtotal = browse-1:query:num-results.
 display
      jlines         column-label "Selected Number!Of Lines"
      jtotal         column-label "Total Number!Of Lines"
      jqty           column-label "Quantity Of!All Lines"
      with frame fselect down row 5 centered overlay.
 pause.

端。 / *在CTRL-L * /