|
|
|
BlueCielo Meridian Enterprise 2012 Developer's Guide | BlueCielo ECM Solutions |
The following sample code demonstrates how to use VBScript to calculate the name of new documents based on a static prefix and a formatted sequential number.
' Document naming function
Function CalculateDocumentName(Doc)
If Doc.DocumentType.InternalName = "GenericDocument" Then
' Use any custom algorithm to calculate the document name
CalculateDocumentName = "MyDocument " & _ FormatSequenceNum(Vault.Sequence("DocumentName").Next, 3)
ElseIf Doc.DocumentType.InternalName = "Your document type name here" Then
' Any document type can have its own calculation
Else
CalculateDocumentName = Doc.FileName
End If
End Function Sub DocGenericEvent_BeforeCalculateFileName(Batch)
' Here we already calculate the new document name.
' We are not limited to the single document-naming expression that
' we can enter for the document type.
' Instead, we call a custom function that can be as complex as required.
' We store the calculated name as a Vault object argument.
Vault.Argument("NewDocumentName") = CalculateDocumentName ( Document )
' From the document-naming expression, you can read this value in the
' Calculate file name expression: Vault.Argument("NewDocumentName")
End Sub
Copyright © 2000-2012 BlueCielo ECM Solutions |