Subroutine help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Kp61dude!
    replied
    Originally posted by wfcmm View Post
    I did exactly what you had on here Kp61dude! and I still get the same "5109_94490-000_0"....it works when you hover over the scripts, but when it gets done running it puts the report in the right path, pc-dmis doesn't seem to like the date.
    Welp, I tried...

    Leave a comment:


  • wfcmm
    commented on 's reply
    I did exactly what you had on here Kp61dude! and I still get the same "5109_94490-000_0"....it works when you hover over the scripts, but when it gets done running it puts the report in the right path, pc-dmis doesn't seem to like the date.

  • Kp61dude!
    replied
    Originally posted by wfcmm View Post
    yea I did..........
    this is my subroutine:

    PRINT_ID =COMMENT/INPUT,NO,FULL SCREEN=NO,
    PRINT ID
    INSPECTOR =COMMENT/INPUT,YES,FULL SCREEN=NO,
    OPERATOR:
    SHOP_ORDER =COMMENT/INPUT,YES,FULL SCREEN=NO,
    WORK ORDER:
    NUMBER_RAN =COMMENT/INPUT,YES,FULL SCREEN=NO,
    SINK:
    ASSIGN/PRINT=PRINT_ID.INPUT
    ASSIGN/WO=SHOP_ORDER.INPUT
    ASSIGN/DATE_STAMP=SYSTEMDATE("ddd")+"_"+SYSTEMDATE("MMM") +"_"+SYSTEMDATE("d")+"_"+SYSTEMDATE("yyyy")+"_" +SY STEMTIME("hh'_'mm'_'ss")
    ASSIGN/FILE_NAME="Y:\Brenco Reports"+""+PRINT_ID.INPUT+""+PRINT_ID.INPUT+"_" +SHOP_ORDER.INPUT+"_"+DATE_STAMP+".PDF"

    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    ****************************************
    FOR THIS TO WORK YOU WILL HAVE TO CHANGE YOUR SEARCH PATH OF SUBROUTINES
    TO THIS Y:\Subroutine\
    THE FOLLOWING LINE OF CODE IS A SUBROUTINE
    MAKE SURE YOU ARE AT THE END OF THE PROGRAM JUST LIKE THE OLD SCRIPT
    YOU MUST GO INSERT, FLOW CONTROL COMMAND CALL SUB
    A WINDOW WILL OPEN AND THEN CLICK SELECT SUBROUTINE
    FIND THIS PROGRAM NAME, SUBROUTINE_GLOBAL, MAKE SURE THERE ARE NO SYMBOLS AFTER PROGRAM NAME
    ONCE YOU HAVE THE CORRECT ONE SELECTED CLICK OK THEN OK
    *****************************************
    SUBROUTINE/SCRIPT-RINGROLL,
    FILE_NAME = "Y:\BRENCO REPORTS"+""+PRINT_ID.INPUT+""+PRINT_ID.INPUT+"_" +SHOP_ORDER.INPUT+"_"+DATE_STAMP+".PDF" : ,
    =
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,OVERWRITE=FILE_NAME,AUTO OPEN REPORT=OFF,$
    TO_PRINTER=OFF,COPIES=1,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMEN SIONS=NO,$
    TO_EXCEL_OUTPUT=OFF,
    PREVIOUS_RUNS=DELETE_INSTANCES
    ENDSUB/
    ASSIGN/DISPLAY_REPORT="C:\Program Files\Adobe\Acrobat Reader DC\Reader\AcroRd32.EXE" + " " + FILE_NAME
    EXTERNALCOMMAND/NO_DISPLAY, NO_WAIT ; FILE_NAME

    this is what I have for my PP:
    at the beginning of the program:
    PRINT_ID =COMMENT/INPUT,NO,FULL SCREEN=NO,
    PRINT ID
    INSPECTOR =COMMENT/INPUT,YES,FULL SCREEN=NO,
    OPERATOR:
    SHOP_ORDER =COMMENT/INPUT,YES,FULL SCREEN=NO,
    WORK ORDER:
    NUMBER_RAN =COMMENT/INPUT,YES,FULL SCREEN=NO,
    SINK:
    at the end of the program:
    ASSIGN/PRINT=PRINT_ID.INPUT
    ASSIGN/WO=SHOP_ORDER.INPUT

    ASSIGN/DATE_STAMP=SYSTEMDATE("ddd")+"_"+SYSTEMDATE("MMM") +"_"+SYSTEMDATE("d")+"_"+SYSTEMDATE("yyyy")+"_" +SY STEMTIME("hh'_'mm'_'ss")
    ASSIGN/FILE_NAME="Y:\Brenco Reports"+""+PRINT_ID.INPUT+""+PRINT_ID.INPUT+"_" +SHOP_ORDER.INPUT+"_"+DATE_STAMP+".PDF"
    CS1 =CALLSUB/SCRIPT-RINGROLL,Y:\Subroutine\chuck2.PRG:,FILE_NAME,


    Sorry for the wall of text


    Add the RED. Delete Green from Part Program.

    Delete ORANGE from your Subroutine.

    I doubt it but in case you are...let me know if you are color blind.
    Last edited by Kp61dude!; 04-05-2018, 03:51 PM.

    Leave a comment:


  • wfcmm
    commented on 's reply
    yea I did..........
    this is my subroutine:

    PRINT_ID =COMMENT/INPUT,NO,FULL SCREEN=NO,
    PRINT ID
    INSPECTOR =COMMENT/INPUT,YES,FULL SCREEN=NO,
    OPERATOR:
    SHOP_ORDER =COMMENT/INPUT,YES,FULL SCREEN=NO,
    WORK ORDER:
    NUMBER_RAN =COMMENT/INPUT,YES,FULL SCREEN=NO,
    SINK:
    ASSIGN/PRINT=PRINT_ID.INPUT
    ASSIGN/WO=SHOP_ORDER.INPUT
    ASSIGN/DATE_STAMP=SYSTEMDATE("ddd")+"_"+SYSTEMDATE("MMM") +"_"+SYSTEMDATE("d")+"_"+SYSTEMDATE("yyyy")+"_"+SY STEMTIME("hh'_'mm'_'ss")
    ASSIGN/FILE_NAME="Y:\Brenco Reports"+"\"+PRINT_ID.INPUT+"\"+PRINT_ID.INPUT+"_" +SHOP_ORDER.INPUT+"_"+DATE_STAMP+".PDF"
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    ****************************************
    FOR THIS TO WORK YOU WILL HAVE TO CHANGE YOUR SEARCH PATH OF SUBROUTINES
    TO THIS Y:\Subroutine\
    THE FOLLOWING LINE OF CODE IS A SUBROUTINE
    MAKE SURE YOU ARE AT THE END OF THE PROGRAM JUST LIKE THE OLD SCRIPT
    YOU MUST GO INSERT, FLOW CONTROL COMMAND CALL SUB
    A WINDOW WILL OPEN AND THEN CLICK SELECT SUBROUTINE
    FIND THIS PROGRAM NAME, SUBROUTINE_GLOBAL, MAKE SURE THERE ARE NO SYMBOLS AFTER PROGRAM NAME
    ONCE YOU HAVE THE CORRECT ONE SELECTED CLICK OK THEN OK
    *****************************************
    SUBROUTINE/SCRIPT-RINGROLL,
    FILE_NAME = "Y:\BRENCO REPORTS"+"\"+PRINT_ID.INPUT+"\"+PRINT_ID.INPUT+"_" +SHOP_ORDER.INPUT+"_"+DATE_STAMP+".PDF" : ,
    =
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,OVERWRITE=FILE_NAME,AUTO OPEN REPORT=OFF,$
    TO_PRINTER=OFF,COPIES=1,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMEN SIONS=NO,$
    TO_EXCEL_OUTPUT=OFF,
    PREVIOUS_RUNS=DELETE_INSTANCES
    ENDSUB/
    ASSIGN/DISPLAY_REPORT="C:\Program Files\Adobe\Acrobat Reader DC\Reader\AcroRd32.EXE" + " " + FILE_NAME
    EXTERNALCOMMAND/NO_DISPLAY, NO_WAIT ; FILE_NAME

    this is what I have for my PP:
    at the beginning of the program:
    PRINT_ID =COMMENT/INPUT,NO,FULL SCREEN=NO,
    PRINT ID
    INSPECTOR =COMMENT/INPUT,YES,FULL SCREEN=NO,
    OPERATOR:
    SHOP_ORDER =COMMENT/INPUT,YES,FULL SCREEN=NO,
    WORK ORDER:
    NUMBER_RAN =COMMENT/INPUT,YES,FULL SCREEN=NO,
    SINK:
    at the end of the program:
    ASSIGN/PRINT=PRINT_ID.INPUT
    ASSIGN/WO=SHOP_ORDER.INPUT
    ASSIGN/DATE_STAMP=SYSTEMDATE("ddd")+"_"+SYSTEMDATE("MMM") +"_"+SYSTEMDATE("d")+"_"+SYSTEMDATE("yyyy")+"_"+SY STEMTIME("hh'_'mm'_'ss")
    ASSIGN/FILE_NAME="Y:\Brenco Reports"+"\"+PRINT_ID.INPUT+"\"+PRINT_ID.INPUT+"_" +SHOP_ORDER.INPUT+"_"+DATE_STAMP+".PDF"
    CS1 =CALLSUB/SCRIPT-RINGROLL,Y:\Subroutine\chuck2.PRG:,,


    Sorry for the wall of text

  • InspectorJester
    replied
    I've had problems with naming files correctly as well. What helped me was saving them as a completely generic name and then, using some FILE IO commands, copying it to the correct location with the correct name (set as a variable) and deleting the default copy.

    Leave a comment:


  • Kp61dude!
    replied
    Originally posted by wfcmm View Post
    it doesn't work for me Kp61dude!....the report goes in the right path, folder etc.....but it doesn't get named right for some reason.......... the report name is
    "5109_94900-000_0" and should be "5109_94900-000_Tue_Apr_3_2018_13_12_35"....the date and time is coming up at -0-

    I did find I put the year and time in the wrong places and changed those around lol.
    Did you try:
    Code:
    ASSIGN/DATE_STAMP=SYSTEMDATE("ddd")+"_"+SYSTEMDATE("MMM")+"_"+SYSTEMDATE("d")+"_"+SYSTEMTIME("hh'_'mm'_'ss")+"_"+SYSTEMDATE("yyyy")
    ASSIGN/FILE_NAME="Y:\Brenco Reports"+"\\"+PRINT_ID.INPUT+"_"+SHOP_ORDER.INPUT+"_"+DATE_STAMP+".PDF"
    Instead of:
    Code:
    ASSIGN/PRINT=PRINT_ID.INPUT
    ASSIGN/WO=SHOP_ORDER.INPUT
    ASSIGN/STRINGDAY=SYSTEMDATE("ddd")
    ASSIGN/INTDAY=SYSTEMDATE("d")
    ASSIGN/MONTH=SYSTEMDATE("MMM")
    ASSIGN/YEAR=SYSTEMDATE("yyyy")
    ASSIGN/TIME=SYSTEMTIME("hh'_'mm'_'ss")
    ASSIGN/DATE_STAMP= STRINGDAY + "_" + MONTH + "_" + INTDAY + "_" + TIME + "_" + YEAR +"
    ASSIGN/WORK_DIR_ST="Y:\Brenco Reports"
    ASSIGN/MAIN=WORK_DIR_ST + "\" + PRINT + "
    ASSIGN/FILE_NAME=MAIN + "\" + PRINT + "_" + WO + "_" + DATE_STAMP + ".pdf"
    actually did you try everything from the second example, after 'or', on post #5? Or what exactly did you change?
    Last edited by Kp61dude!; 04-05-2018, 12:11 PM.

    Leave a comment:


  • wfcmm
    commented on 's reply
    it doesn't work for me Kp61dude!....the report goes in the right path, folder etc.....but it doesn't get named right for some reason.......... the report name is
    "5109_94900-000_0" and should be "5109_94900-000_Tue_Apr_3_2018_13_12_35"....the date and time is coming up at -0-

    I did find I put the year and time in the wrong places and changed those around lol.

  • wfcmm
    commented on 's reply
    I am trying it this morning...I started making changes yesterday and had some "hot" projects to get done....I will be sure to let you know how it works.....Thanks for the help, so far

  • Kp61dude!
    replied
    wfcmm did you try it?

    Leave a comment:


  • Kp61dude!
    replied
    Try these changes.
    Code:
    ASSIGN/PRINT=PRINT_ID.INPUT
    ASSIGN/WO=SHOP_ORDER.INPUT
    ASSIGN/STRINGDAY=SYSTEMDATE("ddd")
    ASSIGN/INTDAY=SYSTEMDATE("d")
    ASSIGN/MONTH=SYSTEMDATE("MMM")
    ASSIGN/YEAR=SYSTEMDATE("yyyy")
    ASSIGN/TIME=SYSTEMTIME("hh'_'mm'_'ss")
    ASSIGN/DATE_STAMP=STRINGDAY+"_"+MONTH+"_"+INTDAY+"_"+TIME+"_"+YEAR
    ASSIGN/WORK_DIR_ST="Y:\Brenco Reports"
    ASSIGN/MAIN=WORK_DIR_ST+"\\"+PRINT
    ASSIGN/FILE_NAME=MAIN+"\\"+PRINT+"_"+WO+"_"+DATE_STAMP+".PDF"
    or
    Code:
    ASSIGN/DATE_STAMP=SYSTEMDATE("ddd")+"_"+SYSTEMDATE("MMM")+"_"+SYSTEMDATE("d")+"_"+SYSTEMTIME("hh'_'mm'_'ss")+"_"+SYSTEMDATE("yyyy")
    ASSIGN/FILE_NAME="Y:\Brenco Reports"+"\\"+PRINT_ID.INPUT+"_"+SHOP_ORDER.INPUT+"_"+DATE_STAMP+".PDF"

    Does this look right to you? Y:\Brenco Reports\5109_949000-000_Tue_Apr_0_03_35_49_2018.PDF

    In your part program:
    Code:
    PRINT_ID   =COMMENT/INPUT,NO,FULL SCREEN=NO,
                Print ID
    INSPECTOR  =COMMENT/INPUT,NO,FULL SCREEN=NO,
                Operator:
    SHOP_ORDER =COMMENT/INPUT,NO,FULL SCREEN=NO,
                Work Order:
    NUMBER_RAN =COMMENT/INPUT,NO,FULL SCREEN=NO,
                Sink:
                ASSIGN/DATE_STAMP=SYSTEMDATE("ddd")+"_"+SYSTEMDATE("MMM")+"_"+SYSTEMDATE("d")+"_"+SYSTEMTIME("hh'_'mm'_'ss")+"_"+SYSTEMDATE("yyyy")
                ASSIGN/FILE_NAME="Y:\Brenco Reports"+"\\"+PRINT_ID.INPUT+"_"+SHOP_ORDER.INPUT+"_"+DATE_STAMP+".PDF"
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                FILE_NAME
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                ****************************************
                FOR THIS TO WORK YOU WILL HAVE TO CHANGE YOUR SEARCH PATH OF SUBROUTINES
                TO THIS Y:\Subroutine\
                THE FOLLOWING LINE OF CODE IS A SUBROUTINE
                MAKE SURE YOU ARE AT THE END OF THE PROGRAM JUST LIKE THE OLD SCRIPT
                YOU MUST GO INSERT, FLOW CONTROL COMMAND CALL SUB
                A WINDOW WILL OPEN AND THEN CLICK SELECT SUBROUTINE
                FIND THIS PROGRAM NAME, SUBROUTINE_GLOBAL, MAKE SURE THERE ARE NO SYMBOLS AFTER PROGRAM NAME
                ONCE YOU HAVE THE CORRECT ONE SELECTED CLICK OK THEN OK
                ****************************************
    
    
    
    
    
    
                 At the END of Program insert a CALLSUB and pass your variable FILE_NAME
    
    
    
    
    
                                           **************USE YOUR OWN PATH BELOW**************
    CS1        =CALLSUB/SCRIPT_RINGROLL,C:\Users\Public\Documents\WAI\PC-DMIS\2015.1\Subroutines\SubRoutineLibrary.PRG:FILE_NAME,,
    Your SUBROUTINE:
    Code:
    SUBROUTINE/SCRIPT_RINGROLL,
                    FILE_NAME =  : ,
                     =
                PRINT/REPORT,EXEC MODE=END,$
                  TO_FILE=ON,OVERWRITE=FILE_NAME,AUTO OPEN REPORT=OFF,$
                  TO_PRINTER=OFF,COPIES=1,$
                  TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
                  REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
                  TO_EXCEL_OUTPUT=OFF,
                  PREVIOUS_RUNS=DELETE_INSTANCES
                ENDSUB/
                ASSIGN/DISPLAY_REPORT="C:\Program Files\Adobe\Acrobat Reader DC\Reader\AcroRd32.EXE" + " " + FILE_NAME
                EXTERNALCOMMAND/NO_DISPLAY, NO_WAIT ; FILE_NAME
    Hope it works!
    Last edited by Kp61dude!; 04-03-2018, 07:13 PM.

    Leave a comment:


  • Schrocknroll
    replied
    PRINTPATH is most likely supposed to be a variable that you need to assign that path to.

    Leave a comment:


  • wfcmm
    replied
    I copied most of the subroutine from someone on the forums a couple of years ago and I have just made mods to it when we needed to. I assume the PRINTPATH line is there to pop the report up on the screen when the program gets done running? everything works with the script except the naming and it doesn't pop up, because the naming is not working.

    this is how the program is named when done running "5109_94900-000_DDD_Apr_D_YYYY_13_MM_SS" it should be named "5109_94900-000_Tue_Apr_3_2018_13_12_35"

    Leave a comment:


  • louisd
    replied
    Originally posted by wfcmm View Post
    ASSIGN/DISPLAY_REPORT="C:\Program Files\Adobe\Acrobat Reader DC\Reader\AcroRd32.EXE" + " " + PRINTPATH
    What is PRINTPATH? I think this might be your issue, more than caps in the date codes.
    You have an assignment PRINT_PATH, but I don't think it belongs with the script line locating the pdf viewer... Right?

    Leave a comment:


  • wfcmm
    started a topic Subroutine help

    Subroutine help

    hello all,

    I am needing help with subroutines below is the list of code we are using and what we want to do is save the reports to a certain folder when the program is done running. I am having problems with the naming of the program, because we would like to use the system date and time in the subroutine, but it changes the subroutines letters to capital letters and pc-dmis wont read them?

    here is the code...

    PRINT_ID =COMMENT/INPUT,NO,FULL SCREEN=NO,
    PRINT ID
    INSPECTOR =COMMENT/INPUT,YES,FULL SCREEN=NO,
    OPERATOR:
    SHOP_ORDER =COMMENT/INPUT,YES,FULL SCREEN=NO,
    WORK ORDER:
    NUMBER_RAN =COMMENT/INPUT,YES,FULL SCREEN=NO,
    SINK:
    ASSIGN/PRINT=PRINT_ID.INPUT
    ASSIGN/WO=SHOP_ORDER.INPUT
    ASSIGN/STRINGDAY=SYSTEMDATE("ddd")
    ASSIGN/INTDAY=SYSTEMDATE("d")
    ASSIGN/MONTH=SYSTEMDATE("MMM")
    ASSIGN/YEAR=SYSTEMDATE("yyyy")
    ASSIGN/TIME=SYSTEMTIME("hh'_'mm'_'ss")
    ASSIGN/DATE_STAMP= STRINGDAY + "_" + MONTH + "_" + INTDAY + "_" + TIME + "_" + YEAR +"
    ASSIGN/WORK_DIR_ST="Y:\Brenco Reports"
    ASSIGN/MAIN=WORK_DIR_ST + "\" + PRINT + "
    ASSIGN/FILE_NAME=MAIN + "\" + PRINT + "_" + WO + "_" + DATE_STAMP + ".pdf"
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    ****************************************
    FOR THIS TO WORK YOU WILL HAVE TO CHANGE YOUR SEARCH PATH OF SUBROUTINES
    TO THIS Y:\Subroutine\
    THE FOLLOWING LINE OF CODE IS A SUBROUTINE
    MAKE SURE YOU ARE AT THE END OF THE PROGRAM JUST LIKE THE OLD SCRIPT
    YOU MUST GO INSERT, FLOW CONTROL COMMAND CALL SUB
    A WINDOW WILL OPEN AND THEN CLICK SELECT SUBROUTINE
    FIND THIS PROGRAM NAME, SUBROUTINE_GLOBAL, MAKE SURE THERE ARE NO SYMBOLS AFTER PROGRAM NAME
    ONCE YOU HAVE THE CORRECT ONE SELECTED CLICK OK THEN OK
    *****************************************
    SUBROUTINE/SCRIPT-RINGROLL,
    PRINT = PRINT_ID.INPUT : ,
    WO = SHOP_ORDER.INPUT : ,
    STRINGDAY = SYSTEMDATE("DDD") : ,
    INTDAY = SYSTEMDATE("D") : ,
    MONTH = SYSTEMDATE("MMM") : ,
    YEAR = SYSTEMDATE("YYYY") : ,
    TIME = SYSTEMTIME("HH'_'MM'_'SS") : ,
    DATE_STAMP = STRINGDAY + "_" + MONTH + "_" + INTDAY + "_" + TIME + "_" + YEAR +" : ,
    WORK_DIR_ST = "Y:\BRENCO REPORTS" : ,
    MAIN = WORK_DIR_ST + "\" + PRINT + " : ,
    FILE_NAME = MAIN + "\" + PRINT + "_" + WO + "_" + DATE_STAMP + ".PDF" : ,
    PRINT_PATH = MAIN + "\" + PRINT + "_" + WO + "_" + DATE_STAMP + " : ,
    =
    ASSIGN/DISPLAY_REPORT="C:\Program Files\Adobe\Acrobat Reader DC\Reader\AcroRd32.EXE" + " " + PRINTPATH
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,OVERWRITE=FILE_NAME,AUTO OPEN REPORT=OFF,$
    TO_PRINTER=OFF,COPIES=1,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMEN SIONS=NO,$
    TO_EXCEL_OUTPUT=OFF,
    PREVIOUS_RUNS=DELETE_INSTANCES
    EXTERNALCOMMAND/DISPLAY ; DISPLAY_REPORT
    ENDSUB/

    For some reason, it changes the ("ddd") to ("DDD") and all of the other lower case letters?

Related Topics

Collapse

Working...
X