0

I'm trying to use a browse in Progress-4gl that will run a control-key to display the number of selected lines within the browse, as well as a total quantity from a temp table for all the lines selected. I have been able to get the total number of lines easily, but when trying to get a total quantity from the temp-table I created, it just has the last selected row value. How do I run a for each from the selected rows? Here's some code I have for the browse:

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 */
4

2 回答 2

1

for anyone wondering...

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.

end. /* on CTRL-L */

于 2012-09-10T16:27:58.783 回答
0

If I understand the question properly you probably want the num-results attribute of the query handle that is associated with the browse -- which would be browse-1:query. So:

jqty = browse-1:query:num-results.
于 2012-09-10T15:29:14.923 回答