hexagon logo

2017 R2: option to retain form dropdown selections

I am trying to help the programmer from one of our sister plants. Currently, there is a form (CS2) that they fill out at the beginning of each run (see image above). I used dropdown lists for the critical fields to prevent typos that would break transferring the measurements to a database. The problem using a dropdown list has created is that while the non-critical fields can be retained for the next run (by answering "Yes" to C1), I could not find a way to retain the dropdown list selections.

I have previously tried using ASSIGN to set them, but the form still defaulted to a blank selection. Does anyone know if it possible to retain all selections and inputs for a follow-up run?

GRP_START  =GROUP/SHOWALLPARAMS=YES
C1           =COMMENT/YESNO,NO,FULL SCREEN=YES,AUTO-CONTINUE=NO,
              Is this the same order as the previous part?
              IF_GOTO/C1.INPUT=="YES",GOTO = CS2
              ASSIGN/CUSTOMER=""
              ASSIGN/SIZE="LG"
              ASSIGN/THICKNESS=3
              ASSIGN/CUT=""
              ASSIGN/MATERIAL=""
              ASSIGN/JOBNUMBER=""
              ASSIGN/SERIALNUMBER=""
              ASSIGN/FIRINGNUMBER=""
CS2          =FORM/FILENAME= C:\USERS\PUBLIC\DOCUMENTS\HEXAGON\PC-DMIS\2017 R2\DO NOT DELETE\LEXINGTONTORSOFORM.FORM
              PARAM/CUSTOMERLIST.TEXTVALUE=CUSTOMER
              PARAM/THICKNESSBOX.TEXT=THICKNESS
              PARAM/MATERIALLIST.TEXTVALUE=MATERIAL
              PARAM/CUTLIST.TEXTVALUE=CUT
              PARAM/SERIALBOX.TEXT=SERIALNUMBER
              PARAM/FIRINGBOX.TEXT=FIRINGNUMBER
              PARAM/JOBBOX.TEXT=JOBNUMBER
              PARAM/=
              ENDFORM/
              ASSIGN/PN=CUSTOMER+CUT+SIZE+THICKNESS+MATERIAL
              COMMENT/REPT,
              "Part Number: "+PN
              COMMENT/REPT,
              "Serial Number: "+SERIALNUMBER
              COMMENT/REPT,
              "Firing Number: "+FIRINGNUMBER
            ENDGROUP/ID=GRP_START

Parents
  • Hello Henniger123, thanks for your reply. Below are the form fields and the names of their objects. I am familiar with "EventInitialize" and "EventTerminate," but I could not figure out how to get them working. I appreciate your help with this.

    FIELD

    OBJECT NAME

    Customer

    customerlist

    Thickness

    thicknessbox

    Material

    materiallist

    Plate Cut Style

    cutlist

    Job Number

    jobbox

    Serial Number

    serialbox

    Firing Number

    firingbox

  • Hello, please make a backup beforehand

    you can edit the form events by double-clicking on the empty field to the right of the event name in the properties window

    insert the following code into the "EventInitialize" event of your Form(View):

      On Error Resume Next
    
      ' Dim Something
        Dim sPath As String
        Dim strLine As String
    
      ' path
        sPath = "C:\Users\Public\Documents\" & "pcDMIS_LastFormEntrys.txt"
    
      ' open file
        Open sPath For Input As #1
        
      ' read line(s)
        Line Input #1, strLine
        strLine = Trim(strLine)
        customerlist.Selection = CDbl(strLine)
        
        Line Input #1, strLine
        strLine = Trim(strLine)
        thicknessbox.Text = CStr(strLine)
        
        Line Input #1, strLine
        strLine = Trim(strLine)
        materiallist.Selection = CDbl(strLine)
        
        Line Input #1, strLine
        strLine = Trim(strLine)
        cutlist.Selection = CDbl(strLine)
        
        Line Input #1, strLine
        strLine = Trim(strLine)
        jobbox.Text = CStr(strLine)
        
        Line Input #1, strLine
        strLine = Trim(strLine)
        serialbox.Text = CStr(strLine)
    
        
        Line Input #1, strLine
        strLine = Trim(strLine)
        firingbox.Text = CStr(strLine)
        
      ' close file
        Close #1


    insert the following code into the "EventTerminate" event of your Form(View):

      On Error Resume Next
      
      ' Dim Something
        Dim sPath As String
        Dim strLine As String
    
      ' path
        sPath = "C:\Users\Public\Documents\" & "pcDMIS_LastFormEntrys.txt"
    
      ' open file
        Open sPath For Output As #2
        
      ' write line(s)
        Print #2, Str(customerlist.Selection)
        Print #2, thicknessbox.Text
        Print #2, Str(materiallist.Selection)
        Print #2, Str(cutlist.Selection)
        Print #2, jobbox.Text
        Print #2, serialbox.Text
        Print #2, firingbox.Text
    
      ' close file
        Close #2

    Everything worked in my test.
    (the path specified in the code must have write permissions)

    you can also create the path dynamically based on the current measurement program, then the form always has the last entry for each program, but that also creates tons of txt files

Reply
  • Hello, please make a backup beforehand

    you can edit the form events by double-clicking on the empty field to the right of the event name in the properties window

    insert the following code into the "EventInitialize" event of your Form(View):

      On Error Resume Next
    
      ' Dim Something
        Dim sPath As String
        Dim strLine As String
    
      ' path
        sPath = "C:\Users\Public\Documents\" & "pcDMIS_LastFormEntrys.txt"
    
      ' open file
        Open sPath For Input As #1
        
      ' read line(s)
        Line Input #1, strLine
        strLine = Trim(strLine)
        customerlist.Selection = CDbl(strLine)
        
        Line Input #1, strLine
        strLine = Trim(strLine)
        thicknessbox.Text = CStr(strLine)
        
        Line Input #1, strLine
        strLine = Trim(strLine)
        materiallist.Selection = CDbl(strLine)
        
        Line Input #1, strLine
        strLine = Trim(strLine)
        cutlist.Selection = CDbl(strLine)
        
        Line Input #1, strLine
        strLine = Trim(strLine)
        jobbox.Text = CStr(strLine)
        
        Line Input #1, strLine
        strLine = Trim(strLine)
        serialbox.Text = CStr(strLine)
    
        
        Line Input #1, strLine
        strLine = Trim(strLine)
        firingbox.Text = CStr(strLine)
        
      ' close file
        Close #1


    insert the following code into the "EventTerminate" event of your Form(View):

      On Error Resume Next
      
      ' Dim Something
        Dim sPath As String
        Dim strLine As String
    
      ' path
        sPath = "C:\Users\Public\Documents\" & "pcDMIS_LastFormEntrys.txt"
    
      ' open file
        Open sPath For Output As #2
        
      ' write line(s)
        Print #2, Str(customerlist.Selection)
        Print #2, thicknessbox.Text
        Print #2, Str(materiallist.Selection)
        Print #2, Str(cutlist.Selection)
        Print #2, jobbox.Text
        Print #2, serialbox.Text
        Print #2, firingbox.Text
    
      ' close file
        Close #2

    Everything worked in my test.
    (the path specified in the code must have write permissions)

    you can also create the path dynamically based on the current measurement program, then the form always has the last entry for each program, but that also creates tons of txt files

Children