Ross Stanek
New Member
I have a detail report that we would like sorted on a subtotal. Is there any way to accomplish this without creating a temporary table to do this.
The code is below. It is sub totalling on the change in the quick-draw variable and we want the group with the highest sub-total to displayed first.
------------------------------------------------
define var x as deci.
define var d1 as date label "Beg-Date".
define var d2 as date label "End-Date".
update d1 d2.
for each invmas no-lock where type = 't',
each i-group no-lock where i-group.group-code = invmas.in-group,
each ordetail no-lock where ordetail.item# = invmas.item-num and (location = '101' or
location = '102' or location = '103' or location = '204' or location = '206' or location =
'221' or location = '308' or location = '309' or location = '310' or location = '313' or
location = '315' or location = '317' or location = '318' or location = '319' or location =
'324' or location = '422' or location = '423'),
each ordhrd of ordetail where ordhrd.inv-date ge d1 and ordhrd.inv-date le d2 and
ordhrd.invoice# ne 0 and type-of-rec ne 8
break by x descending by quick-draw by in-group descending.
assign x = x + qty-shipped.
if last-of(in-group) then do:
display quick-draw column-label "Size"
in-group column-label "Group"
i-group.descr column-label "Description"
x(total by quick-draw) column-label "QTY".
assign x= 0.
Thanks,
Ross
The code is below. It is sub totalling on the change in the quick-draw variable and we want the group with the highest sub-total to displayed first.
------------------------------------------------
define var x as deci.
define var d1 as date label "Beg-Date".
define var d2 as date label "End-Date".
update d1 d2.
for each invmas no-lock where type = 't',
each i-group no-lock where i-group.group-code = invmas.in-group,
each ordetail no-lock where ordetail.item# = invmas.item-num and (location = '101' or
location = '102' or location = '103' or location = '204' or location = '206' or location =
'221' or location = '308' or location = '309' or location = '310' or location = '313' or
location = '315' or location = '317' or location = '318' or location = '319' or location =
'324' or location = '422' or location = '423'),
each ordhrd of ordetail where ordhrd.inv-date ge d1 and ordhrd.inv-date le d2 and
ordhrd.invoice# ne 0 and type-of-rec ne 8
break by x descending by quick-draw by in-group descending.
assign x = x + qty-shipped.
if last-of(in-group) then do:
display quick-draw column-label "Size"
in-group column-label "Group"
i-group.descr column-label "Description"
x(total by quick-draw) column-label "QTY".
assign x= 0.
Thanks,
Ross