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

  • Post your code. We can't diagnose what we can't see.
  • Post your code. We can't diagnose what we can't see.


    Sorry, I forgot - I will say my variables are all storing the correct value though but its the output file name box that's changing.. I enter the variable name in as indicated in the linked guide, but when I save/close/reopen it no longer has the variable name in that box but rather the full file name from the last run which seems odd.

    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"​


  • 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​
    
  • 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.
  • I was able to isolate what was causing the problem. The code and the variable works fine and repeats even after closing the program and re-opening - BUT if I have the report window open and I press the "print report" icon, that is when the file output name gets changed from the variable name (REPORT_NAME) to the last used name/path. Otherwise If I run, close, re-open, etc it will still have "REPORT_NAME" in the field and work as intended. It's only when pressing the print report icon that it changes and "breaks" the variable reference so to speak. Odd isn't it?