Export comments in CSV

Hi friends

I have a problem with the comments property, my client export a CSV with all the metadata of the documents, in this metadata there are small comments, usually the last comment should come. But when the CSV is created it does not bring me any comments because the version of the object has changed and although it has comments like change, the version does not bring me any.

I would like some solution so that my client can export the last comment, try to create a multi-line property and with the automatic value put a VBScript that looks for all comments, but when exporting the CSV it gets messy because it usually brings more than two comments .

Please if anyone has an idea or possible request

I attach images of the CSV and how it appears in M-Files.

Csv

Parents
  • Hey Johnny, comments are version specific and since the CSV export only brings the latest version this information typically is not included.  You're on the right track with an Automatic Value.  If you have a script please paste it in the chat and I can try and take a look at it to provide better suggestions on how to get it working properly.

  • Hello Tom

    I am really very new to VBScript and I have been moving the code to make it work for me, I need it to bring me the last comment made, regardless if the version changes always look for the last one, it means that if it is already in version 11 but the last comment was made at 8 bring me to the property.

    This code brings me all the comments made on the object. I only require the last one made. Since if I use this when exporting the CSV gets messy

    I would really appreciate your help.

    Option Explicit
    
    Dim oVersionComments : Set oVersionComments = Vault.ObjectPropertyOperations.GetVersionCommentHistory(ObjVer)
    
    If oVersionComments.Count > 0 Then
    
    	Dim szAllComments
        Dim oOneComment
    
    
    	For Each oOneComment in oVersionComments
         szAllComments = szAllComments & " - "   & oOneComment.VersionComment.GetValueAsUnlocalizedText & Chr(10)
    	Next 
    
    	Output = szAllComments
    End If

  • I've modified the script to output latest comment in the field only.  The For loop you had was iterating through all the comment history and concatenating everything into the field, since you only need the latest you only need the first item in the comment array. 

    Option Explicit
    
    Dim oVersionComments : Set oVersionComments = Vault.ObjectPropertyOperations.GetVersionCommentHistory(ObjVer)
    
    If oVersionComments.Count > 0 Then
    
    	Dim szLatestComment
        
    	szLatestComment = oVersionComments.Item(1).VersionComment.GetValueAsUnlocalizedText
    
    	Output = szLatestComment
    
    End If

  • It worked perfect thank you very much

Reply Children
No Data