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

  • Thank you so much for putting this together for me. It is successfully outputting and inputting, but it is adding extra returns after every repetition. I cannot see the returns in PC-DMIS. I illustrated them in the TXT output (first image), and it is affecting my CSV outputs (second image).

  • I'm trying to read through this and see what jumps out at me for why there is returns, but I can't tell at the moment. Are you adding spaces or returns in your input commands?

    I know this is already working for you, and you just have a small hiccup, but could you also use a method similar to this one I shared here?

    https://nexus.hexagon.com/community/public/pc-dmis/f/pc-dmis-for-cmms/139275/export-generic-txt-not-showing-all-dimensions-pc-dmis-2022-1/810989

  • I am not hitting the enter key while filling out the form. There are no spaces being entered either and I think the Trim commands during the Initialize stage would remove any that were entered.

    I would like to avoid touching the exporting of the results section. The program has been successfully exporting and uploading to our database for a couple months and I do not want to risk breaking that as I am not on-site to troubleshoot. Thanks for the suggestion.

  • No worries there, I understand where you're coming from. So I was researching this, and I was using Trim, LTrim, and RTrim to see if PC-DMIS would remove spaces in my comment, and it is not. I may have a typo somewhere, but it is keeping all my spaces.

Reply Children
No Data