hexagon logo

Variable in Output File Name Issue - Followed Hexagon's Guide

Hi everyone,

I'm trying to utilize a variable in my program to change the file name when outputting the report. I followed the Hexagon guide I linked to below, but if I close and reopen the program, it removes the variable name I put in the output box and replaces it with whatever it was on the previous run. Any idea why that's happening?

Edit: forgot to add, I'm using PC-DMIS CAD 2018 R2 Build#504 SP8
Edit 2: forgot code.

C1         =COMMENT/INPUT,NO,FULL SCREEN=NO,
            CMM OPERATOR
C2         =COMMENT/INPUT,NO,FULL SCREEN=NO,
            WORK ORDER
C3         =COMMENT/INPUT,NO,FULL SCREEN=NO,
            -THRU-
            ASSIGN/PROG_NAME=GETPROGRAMINFO ("PARTNAME")
            ASSIGN/OP=C1.INPUT
            ASSIGN/WO=C2.INPUT
            ASSIGN/THRU=C3.INPUT
            ASSIGN/REPORT_NAME="R:\\XXXX\\XXXXX\\CMM\\"+PROG_NAME+"_"+WO+"_"+THRU+".RTF"​


{"alt":"Click image for larger version Name:\tREPORTNAME.png Views:\t0 Size:\t20.8 KB ID:\t528181","data-align":"none","data-attachmentid":"528181","data-size":"custom","height":"263","title":"REPORTNAME.png","width":"360"}​​

Output to a File Using Expressions
https://docs.hexagonmi.com/pcdmis/2022.2/en/helpcenter/mergedProjects/core/04_file_bas_topics/Output_to_a_File_Using_Expressions.htm

Parents
  • When you 'F9' a print command or you go through the File>Printing>... dialogue the information will appear with the variables substituted as you planned. But when you just execute the blocks, the variables will be overwritten and correctly format for your new run.
    Are you experiencing something different or just hung up because it appears with the variables substituted?

    I recommend filling a print command to using the File>Printing>... to review the path.

    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,OVERWRITE=REPORT_NAME,AUTO OPEN=OFF,$
    TO_PRINTER=OFF,COPIES=1,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME=REPORT_NAME​,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    TO_EXCEL=OFF,$
    PREVIOUS_RUNS=DELETE_INSTANCES​
    


    I see what you are saying, I will try that to check it. What prompted me to notice it is I entered a different "thru" value when running it today and it overwrote over the previous file instead of creating a new one with the new name per the variable, which is what it was doing when I originally tested this.
Reply
  • When you 'F9' a print command or you go through the File>Printing>... dialogue the information will appear with the variables substituted as you planned. But when you just execute the blocks, the variables will be overwritten and correctly format for your new run.
    Are you experiencing something different or just hung up because it appears with the variables substituted?

    I recommend filling a print command to using the File>Printing>... to review the path.

    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,OVERWRITE=REPORT_NAME,AUTO OPEN=OFF,$
    TO_PRINTER=OFF,COPIES=1,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME=REPORT_NAME​,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    TO_EXCEL=OFF,$
    PREVIOUS_RUNS=DELETE_INSTANCES​
    


    I see what you are saying, I will try that to check it. What prompted me to notice it is I entered a different "thru" value when running it today and it overwrote over the previous file instead of creating a new one with the new name per the variable, which is what it was doing when I originally tested this.
Children
No Data