3 Replies Latest reply on Feb 21, 2014 9:14 AM by Bryan Jenkins

    Enterprise PDM API

    Bryan Jenkins

      Anyone,

       

      We are trying to get information from our MRP/ERP, Work Order documents and other sources into variables on folder and file data cards.   This information (at the moment) is being processed by a VB.NET/EXE application. So we have the individual data strings separated by VB.NET variables.  But we are having problems setting the variable value for (folder/File Data card a object a  variable input).   Are we looking at this from the wrong direction? Or does someone know of a .dll call that we might not have looked at?

        • Re: Enterprise PDM API
          Jeff Sweeney

          I think you have a good plan. The native EPDM API can do this. Are you using the SetVar Method (IEdmEnumeratorVariable5)?

            • Re: Enterprise PDM API
              Bryan Jenkins

              Yes is the short answer...I am trying some example code i found in the API help but i'm getting an error now on the LBound/UBound.  heres the code.

               

              Dim varEnum As IEdmEnumeratorVariable5

                              varEnum = aFile.GetEnumeratorVariable

               

                              Dim valueList() As Object = Nothing

                              varEnum.GetUpdateVars(aFile.LockedInFolderID, valueList)

               

                              Dim idx As Integer

                              idx = LBound(valueList)

                              Dim upper As Integer

                              upper = UBound(valueList)

               

                              Dim msg As String

                              msg = "Card variables for " & aFile.Name & " in configuration, @:" & vbLf & vbLf

               

                              Dim varMgr As IEdmVariableMgr5

                              varMgr = aFile.Vault

               

                              Dim var As IEdmVariable5

                              Dim value As IEdmVariableValue6

                              While idx <= upper

                                  value = valueList(idx)

                                  idx = idx + 1

                                  var = varMgr.GetVariable(value.VariableID)

                                  msg = msg & value.VariableName & " = > " & value.GetValue("@").ToString() & vbLf

                                  msg = msg & "EdmVariableFlags: " & var.Flags & ", EdmVariableType: " & var.VariableType & vbLf & vbLf

                                  'msg = msg & "EdmVariableFlags: " & value.VariableFlags & ", EdmVariableType: " & value.VariableType & vbLf & vbLf

                              End While

               

                              MessageBox.Show(msg)

                • Re: Enterprise PDM API
                  Bryan Jenkins

                  This is the code that fixed my problem.

                   

                         Try

                              Dim enumVariable As IEdmEnumeratorVariable8

                              enumVariable = aFile.GetEnumeratorVariable(ListBox.Items(0).ToString())

                              enumVariable.SetVar("ProjectNumber", "@", "12345")

                              enumVariable.CloseFile(True)

                   

                              MessageBox.Show("Project Number set to " + "12345" + vbLf)

                   

                          Catch ex As System.Runtime.InteropServices.COMException

                              MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)

                          Catch ex As Exception

                              MessageBox.Show(ex.Message)

                          End Try