0 Replies Latest reply on Jul 7, 2015 4:19 PM by Steve Soeder

    EPDM: Add file references without showing in Bill of Material?

    Steve Soeder

      I'm adding file references programmatically and I don't see a way to specify whether or not I want to show the references in the BOM, which is checked yes by default.

      Here is a snipped from my working code.  The references are added, but I don't necessarily want them shown in the BOM.  How can I tell EPDM to uncheck this option?

       

              Try
                  CustomRefs = TheVault.CreateUtility(EdmUtility.EdmUtil_AddCustomRefs) 'CustomRefs is declared earlier as type "IEdmAddCustomRefs"
                  For Each inFile As String In inRefFiles
                      Try
                          ParentFile = TheVault.GetFileFromPath(inFile)
                          ParentFolder = TheVault.GetFolderFromPath(Left(inFile, InStrRev(inFile, "\")))
                          With ParentFile
                              If Not .IsLocked Then
                                  LockFlag = True
                                  .LockFile(ParentFolder.ID, TheCommand.mlParentWnd, CInt(EdmLockFlag.EdmLock_Simple))
                              End If
                          End With
      
      
                          CustomRefs.AddReferencesPath(ParentFile.ID, ReferenceFiles.ToArray)
                          ReturnFlag = CustomRefs.CreateTree(0) 'Must create the reference tree first before we can show the dialog or create the references
      #If CONFIG = "Debug" Then
                          ReturnFlag = CustomRefs.ShowDlg(TheCommand.mlParentWnd)
      #End If
      
      
                          If ReturnFlag Then ReturnFlag = CustomRefs.CreateReferences()
                          If ReturnFlag Then TheVault.RefreshFolder(ParentFolder.LocalPath)
                          If Not ReturnFlag Then Throw New Exception("ERROR: Could not create the file reference(s) on " & ParentFile.Name & "." & vbNewLine & _
                                      "Check to ensure that files being created by the template are NOT checked in by the template.  " & vbNewLine & _
                                      "If still having problems, contact the EPDM administrator.")
                          If LockFlag Then ParentFile.UnlockFile(TheCommand.mlParentWnd, "System: Added reference(s) for " & String.Join(";", ReferenceFiles.ToArray) & " created by " & TheTemplateName, 0)
                          'reset for the next loop
                          ReturnFlag = False
                          LockFlag = False
                          ParentFile = Nothing
                          ParentFolder = Nothing
                      Catch ex As Exception
                          Exceptions.Add(ex)
                      End Try
                  Next
              Catch ex As Exception
                  MessageBox.Show(ex.ToString, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
              End Try
      

      (Note: I realize IEdmAddCustomRefs2 has superceded IEdmAddCustomRefs, but at this time I see no reason to change my code as I don't need to enter quantity info)