Set Revision through API

Hello,

I have an API that is supposed to be setting the PDM vault revision counter, and runs without error, but does not actually write the new revision value.

Background: I’m trying to set revisions for a vault of legacy data where the rev is stored in the custom properties via external PDM and PLM systems, but the actual vault PDM rev isn’t set.

Code details: I’m pulling the correct legacy revision from the custom properties via Document Manager API (plus some additional user input when there are 2+ unique revs saved on the same file :unamused: ), and reading the information for the revision counter name and value through the PDM API. A lot of the code in question is borrowed heavily from the “Set Initial Revision” Help example:http://help.solidworks.com/2020/english/api/epdmapi/Set_Initial_Revision_Example_VBNET.htm.

This seems to be the problem area:

If Not currentRev = newRev Then
            MsgBox("The PDM Revision, ( " & currentRev & " ), will be set to the file property revision, ( " & newRev & " ).")
            Dim RevCounters(0) As EdmRevCounter            'Assign the name of the revision counter  
            RevCounters(0).mbsComponentName = revVarName
            Dim RevInt As Long
            RevInt = Asc(newRev.ToUpper()) - Asc("A") + 1 ' Assign the New revision counter value to the value stored in the Revision card variable converted to an integer
            RevCounters(0).mlCounter = RevInt
            RevMgr.IncrementRevision(pdmFile.ID)
            Debug.Print("After incrementing, currentRev is  :" & pdmFile.CurrentRevision)
            RevMgr.SetRevisionCounters(pdmFile.ID, RevCounters)             'Set the revision counter to the new values
            Debug.Print("RevCounter value is  " & RevCounters(0).mlCounter)
            Debug.Print("Rev alpha value will be " & Chr(RevCounters(0).mlCounter))
            Dim RevErrors() As EdmRevError = {}
            RevMgr.Commit("Set starting revision for legacy file.", RevErrors) 'Save the new values to the database
            Debug.Print("After committing, currentRev is  :" & pdmFile.CurrentRevision)
        Else
            MsgBox("The PDM revision (" & currentRev & " ) already matches the cprop rev ( " & newRev & " )!")
            Exit Sub
        End If

I’m running out of troubleshooting ideas - there are debug statements every other line, and everything works perfectly right up to the set of write statements (RevMgr.IncrementRevision, RevMgr.SetRevisionCounters, RevMgr.Commit). There’s no error or exception; the PDM revision just won’t write. o[

Any ideas what I’m doing wrong?

A couple things if you don’t mind a little “spit-balling”:

A couple things if you don’t mind a little “spit-balling”:

That was it! I had defined it as the name of the revision variable instead of the revision number component - there are way, way too many “revisions” in our system at the moment, and I lost track.

Thanks so much!