Is there a way to do a bi-level break by statement? I need to do the following:
Break all orders by the sales person that took them --> Break those blocks up by order number to gather data.
I'm trying to run a daily sales report that takes the total orders/salesperson as well as their total units sold and total price sold.
This is what it would look like basically (please correct if possible). I had all the daily values dump into a temp table from a separate output that put out a spreadsheet as well.
Thank you.
Edit: Code tags added.
Break all orders by the sales person that took them --> Break those blocks up by order number to gather data.
I'm trying to run a daily sales report that takes the total orders/salesperson as well as their total units sold and total price sold.
This is what it would look like basically (please correct if possible). I had all the daily values dump into a temp table from a separate output that put out a spreadsheet as well.
Code:
DEF VAR ordqty AS INT NO-UNDO. /*total orders for the day*/
DEF VAR totqty AS INT NO-UNDO. /*total units sold*/
DEF VAR totprice AS INT NO-UNDO. /*total price sold*/
OUTPUT TO VALUE(T-FILE). /*value listed earlier in report*/
EXPORT DELIMITER ","
"TakenBy"
"Total Orders"
"Total Units"
"Price"
.
FOR EACH tt-takenby
BREAK BY tt-takenby.takenby:
ordqty = 0.
totqty = 0.
totprice = 0.
BREAK-BY tt-takenby.co-num:
IF FIRST-OF(tt-takenby.co-num) THEN DO:
ordqty = ordqty + 1.
totqty = totqty + tt-takenby.qty.
totprice = totprice + tt-takenby.price.
ELSE DO:
totqty = totqty + tt-takenby.qty.
totprice = totprice + tt-takenby.price.
IF LAST-OF(tt-takenby.co-num) THEN DO:
EXPORT DELIMITER ","
tt-takenby.takenby
ordqty
totqty
totprice
.
END.
Thank you.
Edit: Code tags added.
Last edited by a moderator: