CONCATE SN to print command

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

  • CONCATE SN to print command

    What am I doing wrong guys?

    ASSIGN/REPORT_NAME="C:\\Users\\30779322\\Documents\\REPOR TS\"+PROG_NAME+SN.INPUT+".PDF"

    the report gets the program name but not the serial number added to it

  • #2
    Just out of curiosity, give this a try. I added " - " between the program name and sn.input. I don't really see anything wrong with it but I usually see inputs separated by " - " or something like it.

    ASSIGN/REPORT_NAME="C:\\Users\\30779322\\Documents\\REPOR TS"+PROG_NAME+" - "+SN.INPUT+".PDF"
    "Do what I want you to do, not what I tell you to do."

    -Me

    Comment


    • #3
      And...that worked. Thanks!

      Comment


      • A-machine-insp
        A-machine-insp commented
        Editing a comment
        No problem. It was really just a shot in the dark.

    • #4
      PROG NAME is likely a string function
      SN.INPUT is likely also a string. it could possibly be created as a real number...
      by having ASSIGN/REPORT_NAME="C:\\Users\\30779322\\Documents\\REPOR TS"+PROG_NAME+SN.INPUT+".PDF"
      you are trying to add the two strings to compute a sum of the two strings.

      --If you put anything between them, to interrupt the sum function you have created, it should work... even a pair of quotes with nothing else would work.
      ASSIGN/REPORT_NAME="C:\\Users\\30779322\\Documents\\REPOR TS" + PROG_NAME + "" + SN.INPUT + ".PDF"
      (Producing) C:\Users\0779322\Documents\REPORTS\PROGRAMNAMESN.PDF

      Personally, I like space hyphen space
      ASSIGN/REPORT_NAME="C:\\Users\\30779322\\Documents\\REPOR TS" + PROG_NAME + " - " + SN.INPUT + ".PDF"
      (Producing) C:\Users\0779322\Documents\REPORTS\PROGRAMNAME - SN.PDF
      Last edited by louisd; 11-12-2019, 12:58 PM.

      Comment


      • #5
        To minimize the number of surprises you get when working with strings, you should *never* concatenate them with "+". Always use the CONCAT(,,,) function instead.

        Code:
          ASSIGN/REPORT_NAME=CONCAT("C:\\Users\\30779322\\Documents\\REPORTS", PROG_NAME,  SN.INPUT,  ".PDF")
        This way, PC-DMIS will never try to interprete your strings as numbers.


        Another thing is that in the OP it looks like there is only a single backslash at the end of the first string (I will not try to quote it, as also the forum does 'things' with the backslash). A single backslash before the ending quote means that the quote will be included in the string, and PC-DMIS gets confused...
        Last edited by AndersI; 11-13-2019, 04:05 AM.
        AndersI
        SW support - Hexagon Metrology Nordic AB

        Comment


        • #6
          This is my sample code. I create the folder where I want my PDFs to go and then I fix the file path below to send it there.
          Code:
          Serial Number:
                        SERIALNUMBERQUESTION   =COMMENT/INPUT,NO,FULL SCREEN=NO,
                        Serial Number:
                        ASSIGN/VAR_SERIALNUMBER="Serial Number: "+SERIALNUMBERQUESTION.INPUT
                        COMMENT/REPT,
                        VAR_SERIALNUMBER
                        ASSIGN/PROG_NAME=GETPROGRAMINFO ("PARTNAME")
                        ASSIGN/REPORT_NAME="O:\\CMM PROGRAMS\\CMM_PDF_PC DMIS\\AG0XXXX_FINAL_XX\\"+PROG_NAME+"__"+SERIALNUMBERQUESTION.INPUT+"-.PDF"
          And then put this at the end of my program:
          Code:
                          PRINT/REPORT,EXEC MODE=END,$
                          TO_FILE=ON,AUTO=1,AUTO OPEN=OFF,$
                          TO_PRINTER=OFF,COPIES=1,$
                          TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=REPORT_NAME,$
                          REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
                          TO_EXCEL=OFF,$
                          PREVIOUS_RUNS=DELETE_INSTANCES
          Last edited by DAN_M; 11-13-2019, 07:15 AM.

          Comment

          Related Topics

          Collapse

          Working...
          X