Error Procedure Not Running

jamie_moore

New Member
Hi,
When running the below code and selecting the file-btn it doesn't run the procedure within the SET statement (fileOutputReport), the MESSAGE statement works so I know the variable is populated with the data entered by the user however it doesn't go ahead and OUTPUT TO the file which is the first line in the procedure. I'm really confused as there are no error's being produced.
Code:
/* FIRST FRAME VARIABLES */
DEFINE VARIABLE iCompany AS INTEGER FORMAT ">>" NO-UNDO LABEL "Company"
  INIT "10".
DEFINE VARIABLE iDepot AS INTEGER FORMAT ">>" NO-UNDO LABEL "Depot"
  INIT "2".
DEFINE VARIABLE daStartDate AS DATE NO-UNDO LABEL "Start Date"
  INIT "  /  /   ".
DEFINE VARIABLE daEndDate AS DATE NO-UNDO LABEL "End Date"
  INIT "  /  /   ".
DEFINE VARIABLE cAdjustType AS CHARACTER NO-UNDO LABEL "Adjust Type"
  INIT "*".
DEFINE VARIABLE cReasonCode AS CHARACTER FORMAT "x(3)" NO-UNDO LABEL "Reason Code"
  INIT "*".
DEFINE VARIABLE deThreshold AS DECIMAL FORMAT ">>9.99" NO-UNDO LABEL "Threshold"
  INIT "0.00".
DEFINE VARIABLE deCostAdj AS DECIMAL NO-UNDO FORMAT "->>>9.99" LABEL "Cost Value"
  INIT "0.00".
DEFINE VARIABLE iNewStk AS INTEGER NO-UNDO FORMAT "->>>>9" LABEL "New Stk"
  INIT "0".



/* SECOND FRAME VARIABLES */
DEFINE BUTTON printer-btn LABEL "Printer".
DEFINE BUTTON terminal-btn LABEL "Terminal".
DEFINE BUTTON file-btn LABEL "File".
DEFINE VARIABLE printerSelected AS CHARACTER FORMAT "x(15)" LABEL "Printer".
DEFINE VARIABLE pathToFile AS CHARACTER FORMAT "x(45)" LABEL "Path to File".




/* Output Options - FRAME 2 */

ENABLE printer-btn HELP "Output to Printer"
       file-btn HELP "Output to File"
       terminal-btn HELP "Output to Terminal Screen"
       WITH FRAME OUTPUT-PROMPT CENTERED TITLE "OUTPUT FORMAT".


ON CHOOSE OF printer-btn DO:
       RUN printerOutput.
END.


ON CHOOSE OF file-btn DO:
       RUN fileOutput.
END.

/* ON CHOOSE OF terminal-btn DO:
       RUN terminalOutput.
END. */

VIEW FRAME OUTPUT-PROMPT.
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW OR CHOOSE OF printer-btn,file-btn,terminal-btn.



PROCEDURE printerOutput.
SET printerSelected HELP "Enter Printer Name"
       WITH 1 COLUMNS FRAME PRINTER-PROMPT TITLE "PRINTER SELECTION" CENTERED
       ROW FRAME-ROW(PRINTER-PROMPT) + 12.
       MESSAGE printerSelected "Chosen".

END PROCEDURE.


PROCEDURE fileOutput.

SET pathToFile HELP "Enter full path to file name"
       WITH 1 COLUMNS FRAME FILE-PROMPT TITLE "FILE CREATION" CENTERED
       ROW FRAME-ROW(FILE-PROMPT) + 12.
       RUN fileOutputReport.
       MESSAGE pathToFile "created".

END PROCEDURE.

PROCEDURE fileOutputReport.
      
OUTPUT TO pathToFile.

/* Header for output file */
DISPLAY "                                       STOCK ADJUSTMENT REPORT"
        WITH 1 COLUMNS FRAME HEADER-1 NO-BOX.

DISPLAY daStartDate
        daEndDate SKIP(2)
        "Adjust Report Date"
        TODAY WITH SIDE-LABELS.
      

FOR EACH order.stkadj WHERE
         company = iCompany AND
         loc-cd = iDepot AND 
         adj-date >= daStartDate AND
         adj-date <= daEndDate,
    EACH main.product OF order.stkadj, /* WHERE company = iCompany, */
    EACH main.stock OF main.product:
         /*WHERE company = iCompany AND
         loc-cd = iDepot: */
         deCostAdj = cost-price * adj-qty.
         iNewStk = old-stk + adj-qty.
            DISPLAY /*stkadj.adj-date*/
                    fwd-loc LABEL "Bin Loc"
                    catalog-no
                    prod-name
                    product.pack
                    stkadj.prod-code LABEL "Code"
                    /*stkadj.reason*/
                    old-stk
                    adj-qty
                    iNewStk
                    /*stkadj.user-id*/
                    deCostAdj
                    (TOTAL)
                    reference WITH WIDTH 145.
END.

OUTPUT CLOSE.
END PROCEDURE.
 
Last edited by a moderator:

jamie_moore

New Member
Thank You that works perfectly, knew it would be something simple!
 
Top