hexagon logo

Update Tracefield with variables, without making a new Tracefield with the same name

Hello,

I want to measure multiple products in 1 program, ll with their own Feature ID's and dimnumbers.
After that I want to export only the dimensions of that particular bit of program to Excel with the Excel FormReport.
Everything is working nicely, except the naming of the file and the tracefields in the header.




...Measuring data

ASSIGN/[COLOR=#c0392b]V_FILENAME_0924_1[/COLOR]=("4022.642.0924 "+VSUFFIX+" ("+GETTRACEVALUE("PO_0924")+") "+GETTRACEVALUE("[COLOR=#c0392b]PN_0924_1[/COLOR]")+"  ")
TRACEFIELD/DISPLAY=NO,REPORT=NO,DISPLAY MESSAGE=- ; trcFileName : V[COLOR=#c0392b]_FILENAME_0924_1[/COLOR]
EXCEL_FORM_0924_1=EXCELFORMREPORT/TEMPLATE=StandardTemplate TYPE=XLSX
            RESULT FOLDER/D:\. Meetdata Excel​

...Measuring data

ASSIGN/[COLOR=#c0392b]V_FILENAME_0924_2[/COLOR]=("4022.642.0924 "+VSUFFIX+" ("+GETTRACEVALUE("PO_0924")+") "+GETTRACEVALUE("[COLOR=#c0392b]PN_0924_2[/COLOR]")+"  ")
TRACEFIELD/DISPLAY=NO,REPORT=NO,DISPLAY MESSAGE=- ; trcFileName : [COLOR=#c0392b]V_FILENAME_0924_2​[/COLOR]
EXCEL_FORM_0924_2=EXCELFORMREPORT/TEMPLATE=StandardTemplate, TYPE=XLSX
            RESULT FOLDER/D:\. Meetdata Excel
​
...Measuring data

ASSIGN/[COLOR=#c0392b]V_FILENAME_0924_3[/COLOR]=("4022.642.0924 "+VSUFFIX+" ("+GETTRACEVALUE("PO_0924")+") "+GETTRACEVALUE("[COLOR=#c0392b]PN_0924_3[/COLOR]")+"  ")
TRACEFIELD/DISPLAY=NO,REPORT=NO,DISPLAY MESSAGE=- ; trcFileName : [COLOR=#c0392b]V_FILENAME_0924_3​[/COLOR]
EXCEL_FORM_0924_3=EXCELFORMREPORT/TEMPLATE=StandardTemplate, TYPE=XLSX​
            RESULT FOLDER/D:\. Meetdata Excel​


What I did was updating the filename (a tracefield) and tracefields for the header with variabels, but it only makes more tracefields witht he same name, thus linking only the first set of tracefields to the report.
The result is that all the headers and all the filenames are the same.

Is there a way so that you can reset or empty an existing tracefield and repopulate it, instead of making a new tracefield with the same name?


Thanks in advance, and have a nice weekend Slight smile

Parents
  • I have figured it out.
    Maybe not the cleanest way, but it does the job:


    I declare variables in PCDMIS each time I want to run a new ExcelFormReport with fresh header data.
    Then pass those variables to the script, and the script searches for the Tracefield and edits with the variable.
    The making of the Tracefields is not in the code below.

    In PCDMIS:
    GRP_TRACEFIELDS_0924_1=GROUP/SHOWALLPARAMS=YES
                  ASSIGN/VCLIENT=GETTRACEVALUE("trcClient")
                  ASSIGN/VPRODUCTNAME=VPRODUCT_0924
                  ASSIGN/VDRAWINGNUMBER=VDRAWING_0924+VSUFFIX
                  ASSIGN/VROOYREF=VREF_0924
                  ASSIGN/VCLIENTREF=VPO_0924
                  ASSIGN/VDATE=V_DATE
                  ASSIGN/VPRODUCTNUMBER=VPN_0924_1
                  ASSIGN/VUNITS=GETTRACEVALUE("trcUnits")
                  ASSIGN/VMACHINENAME=MACHINENAME
                  ASSIGN/VMACHINEACCURACY=MACHINEACCURACY
                  ASSIGN/VREPORTTYPE="EXTERN"
                  ASSIGN/V_FILENAME=(VDRAWINGNUMBER+" ("+VROOYREF+") "+VPRODUCTNUMBER+"     ")
    Script_Tracefields  =SCRIPT/FILENAME= "D:\PMM & Crysta\Scripts\ResetTraceFields_Movers.bas"
                  FUNCTION/Main,SHOW=YES,ARG1=VCLIENT,ARG2=VPRODUCTNAME,ARG3=VDRAWINGNUMBER,ARG4=VROOYREF,ARG5=VCLIENTREF,$
                      ARG6=VDATE,ARG7=VPRODUCTNUMBER,ARG8=VUNITS,ARG9=VMACHINENAME,ARG10=VMACHINEACCURACY,$
                      ARG11=VREPORTTYPE,ARG12=V_FILENAME,,
                  STARTSCRIPT/
                  ENDSCRIPT/
                ENDGROUP/ID=GRP_TRACEFIELDS_0924_1
    EXCEL_FORM_0924_1=EXCELFORMREPORT/TEMPLATE=DeRooy PCDMIS Report, TYPE=XLSX
                RESULT FOLDER/D:\. Meetdata Excel​
    


    In .bas script:
    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim Commands As Object
    Dim Command As Object
    Dim TraceCommand As Object
    
    Sub Main (strClient As String, strProductName As String, strDrawingNumber As String, strRooyRef As String, strClientRef As String, strDate As String, strProductNumber As String, strUnits As String, strMachineName As String, strMachineAccuracy As String, strReportType As String, strFileName As String)
    
      Set DmisApp = CreateObject("PCDLRN.Application")
      Set DmisPart = DmisApp.ActivePartProgram
      Set Commands = DmisPart.Commands
    
      For Each Command In Commands
       If Command.IsTraceField Then
          Set TraceCommand = Command.TraceFieldCommand
              If  TraceCommand.Name = "trcClient" Then
                       TraceCommand.Value = strClient
              End If
              If  TraceCommand.Name = "trcProductName" Then
                       TraceCommand.Value = strProductName
              End If
              If  TraceCommand.Name = "trcDrawingNumber" Then
                       TraceCommand.Value = strDrawingNumber
              End If
              If  TraceCommand.Name = "trcRooyRef" Then
                       TraceCommand.Value = strRooyRef
              End If
              If  TraceCommand.Name = "trcClientRef" Then
                       TraceCommand.Value = strClientRef
              End If
              If  TraceCommand.Name = "trcDate" Then
                       TraceCommand.Value = strDate
              End If
              If  TraceCommand.Name = "trcProductNumber" Then
                       TraceCommand.Value = strProductNumber
              End If
              If  TraceCommand.Name = "trcUnits" Then
                       TraceCommand.Value = strUnits
              End If
              If  TraceCommand.Name = "trcMachineName" Then
                       TraceCommand.Value = strMachineName
              End If
              If  TraceCommand.Name = "trcMachineAccuracy" Then
                       TraceCommand.Value = strMachineAccuracy
              End If
              If  TraceCommand.Name = "trcReportType" Then
                       TraceCommand.Value = strReportType
              End If
              If  TraceCommand.Name = "trcFileName" Then
                       TraceCommand.Value = strFileName
              End If
    
       Set TraceCommand = Nothing
    End If
      Next Command
    
    
    Set Commands = Nothing
    Set DmisPart = Nothing
    Set DmisApp = Nothing
      
    End Sub​
    



    Maybe someone will be helped with this info.
Reply
  • I have figured it out.
    Maybe not the cleanest way, but it does the job:


    I declare variables in PCDMIS each time I want to run a new ExcelFormReport with fresh header data.
    Then pass those variables to the script, and the script searches for the Tracefield and edits with the variable.
    The making of the Tracefields is not in the code below.

    In PCDMIS:
    GRP_TRACEFIELDS_0924_1=GROUP/SHOWALLPARAMS=YES
                  ASSIGN/VCLIENT=GETTRACEVALUE("trcClient")
                  ASSIGN/VPRODUCTNAME=VPRODUCT_0924
                  ASSIGN/VDRAWINGNUMBER=VDRAWING_0924+VSUFFIX
                  ASSIGN/VROOYREF=VREF_0924
                  ASSIGN/VCLIENTREF=VPO_0924
                  ASSIGN/VDATE=V_DATE
                  ASSIGN/VPRODUCTNUMBER=VPN_0924_1
                  ASSIGN/VUNITS=GETTRACEVALUE("trcUnits")
                  ASSIGN/VMACHINENAME=MACHINENAME
                  ASSIGN/VMACHINEACCURACY=MACHINEACCURACY
                  ASSIGN/VREPORTTYPE="EXTERN"
                  ASSIGN/V_FILENAME=(VDRAWINGNUMBER+" ("+VROOYREF+") "+VPRODUCTNUMBER+"     ")
    Script_Tracefields  =SCRIPT/FILENAME= "D:\PMM & Crysta\Scripts\ResetTraceFields_Movers.bas"
                  FUNCTION/Main,SHOW=YES,ARG1=VCLIENT,ARG2=VPRODUCTNAME,ARG3=VDRAWINGNUMBER,ARG4=VROOYREF,ARG5=VCLIENTREF,$
                      ARG6=VDATE,ARG7=VPRODUCTNUMBER,ARG8=VUNITS,ARG9=VMACHINENAME,ARG10=VMACHINEACCURACY,$
                      ARG11=VREPORTTYPE,ARG12=V_FILENAME,,
                  STARTSCRIPT/
                  ENDSCRIPT/
                ENDGROUP/ID=GRP_TRACEFIELDS_0924_1
    EXCEL_FORM_0924_1=EXCELFORMREPORT/TEMPLATE=DeRooy PCDMIS Report, TYPE=XLSX
                RESULT FOLDER/D:\. Meetdata Excel​
    


    In .bas script:
    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim Commands As Object
    Dim Command As Object
    Dim TraceCommand As Object
    
    Sub Main (strClient As String, strProductName As String, strDrawingNumber As String, strRooyRef As String, strClientRef As String, strDate As String, strProductNumber As String, strUnits As String, strMachineName As String, strMachineAccuracy As String, strReportType As String, strFileName As String)
    
      Set DmisApp = CreateObject("PCDLRN.Application")
      Set DmisPart = DmisApp.ActivePartProgram
      Set Commands = DmisPart.Commands
    
      For Each Command In Commands
       If Command.IsTraceField Then
          Set TraceCommand = Command.TraceFieldCommand
              If  TraceCommand.Name = "trcClient" Then
                       TraceCommand.Value = strClient
              End If
              If  TraceCommand.Name = "trcProductName" Then
                       TraceCommand.Value = strProductName
              End If
              If  TraceCommand.Name = "trcDrawingNumber" Then
                       TraceCommand.Value = strDrawingNumber
              End If
              If  TraceCommand.Name = "trcRooyRef" Then
                       TraceCommand.Value = strRooyRef
              End If
              If  TraceCommand.Name = "trcClientRef" Then
                       TraceCommand.Value = strClientRef
              End If
              If  TraceCommand.Name = "trcDate" Then
                       TraceCommand.Value = strDate
              End If
              If  TraceCommand.Name = "trcProductNumber" Then
                       TraceCommand.Value = strProductNumber
              End If
              If  TraceCommand.Name = "trcUnits" Then
                       TraceCommand.Value = strUnits
              End If
              If  TraceCommand.Name = "trcMachineName" Then
                       TraceCommand.Value = strMachineName
              End If
              If  TraceCommand.Name = "trcMachineAccuracy" Then
                       TraceCommand.Value = strMachineAccuracy
              End If
              If  TraceCommand.Name = "trcReportType" Then
                       TraceCommand.Value = strReportType
              End If
              If  TraceCommand.Name = "trcFileName" Then
                       TraceCommand.Value = strFileName
              End If
    
       Set TraceCommand = Nothing
    End If
      Next Command
    
    
    Set Commands = Nothing
    Set DmisPart = Nothing
    Set DmisApp = Nothing
      
    End Sub​
    



    Maybe someone will be helped with this info.
Children
No Data