2 Replies Latest reply on Aug 31, 2015 5:49 PM by Steve Soeder

    Why are these variables not setting/updating on my card?

    Steve Soeder

      I'm trying to use IEdmEnumeratorVariable5::SetVar to update some file card variables based on user input into a windows form.

      The code executes, the file is checked out and checked back in with the appropriate comment in the history; however the variables on the card are not updated.


      Here is my code - not sure where the problem is.  Hoping someone can see it!

      In efforts to make it as concise as possible, I've commented what some of the variables are.  I have confirmed the data in all of my variables is correct at run-time. 

       

      NOTE:  I don't know when this forum introduced this new code recognition feature, but it is awful!!  I could not paste from visual studio to here - it kept trying to interpret things and deleted lines of code, changed expressions, etc.  Very very bad!!  I had to copy everything into notepad and copy/paste from there.  It still kept adding "true" in random inappropriate places wherever I had an "IF" block that had to be deleted, and I lost all formatting so now everything appears blue.  This is the best I could get it to look.  Sorry if it's tough to read.  If you find typos, it's most likely due to editing.  The code does execute - there are no compile errors .

       

       

                With ReceivedCommand  'Private Structure.  Contains:  .SourceVault = poCmd.mpoVault; .SourceCommand = poCmd; .SourceSelection = ppoData
                      Dim RequestFile As IEdmFile5 = .SourceVault.GetFileFromPath(Path)
                      Dim ParentFolder As IEdmFolder6 = .SourceVault.GetFolderFromPath(Left(Path, InStrRev(Path, "\")))
                      Dim UnlockLater As Boolean = False

       

                      If Not RequestFile.IsLocked Then
                          UnlockLater = RequestFile.LockFile(ParentFolder.ID, .SourceCommand.mlParentWnd, CInt(EdmLockFlag.EdmLock_Simple))

                      End If

       

                      Dim CardVariables As IEdmEnumeratorVariable5 = RequestFile.GetEnumeratorVariable

       

                      Dim CardComment As String = String.Empty
                      Dim CardBy As String = String.Empty
                      Dim CardDate As String = String.Empty
                      Dim CardDisposition As String = String.Empty
                      Dim Success As Boolean

                    

                      'Card variable names.  I've double checked and these are correct.  All tied to "edit box" controls on the file card.

                      Const CommentVariable As String = "DispComm"
                      Const ByVariable As String = "DisposedBy"
                      Const DateVariable As String = "DisposedDate"
                      Const DispositionVariable As String = "Disposition"

       

                      'We allow users to re-disposition a request so we want to keep any previous disposition information so it is not lost

                      Success = CardVariables.GetVar(DispositionVariable, "@", CardDisposition)

                      If Success Then
                          Success = CardVariables.GetVar(CommentVariable, "@", CardComment)
                          If Success then Success = CardVariables.GetVar(ByVariable, "@", CardBy)
                          If Success then Success= CardVariables.GetVar(DateVariable, "@", CardDate)
                          If Success Then CardComment = "Previously dispositioned as: """ & CardDisposition & """ by: " & CardBy & " on: " & CardDate & vbNewLine &
                                                           "---------Previous disposition explanation---------" & vbNewLine & CardComment
                      End If

       

                      Dim UserManager As IEdmUserMgr5 = .SourceVault
                      Dim User As IEdmUser5 = UserManager.GetLoggedInUser

       

                      CardComment = UserComment & CardComment 'UserComment is a String.  Populated from a windows form text box.
                      CardDate = Today().ToString("yyMMdd", Globalization.CultureInfo.InvariantCulture)
                      CardBy = User.Name
                      CardDisposition = UserDisposition 'UserDisposition is a String.  Populated from a windows form text box.

       

                      CardVariables.SetVar(DispositionVariable, "@", CardDisposition)
                      CardVariables.SetVar(CommentVariable, "@", CardComment)
                      CardVariables.SetVar(ByVariable, "@", CardBy)
                      CardVariables.SetVar(DateVariable, "@", CardDate)
                      CardVariables.Flush()

       

                      If UnlockLater Then RequestFile.UnlockFile(lParentWnd:= .SourceCommand.mlParentWnd,
                                                                  bsComment:="Dispositioned as " & CardDisposition,
                                                                  lEdmUnlockFlags:=0)


                      .SourceVault.RefreshFolder(ParentFolder.LocalPath)


                  End With