You are viewing limited content. For full access, please sign in.

Question

Question

Parse a Filename to obtain Metadata prior to import

asked on March 26, 2014

 

To all,

I am new to Laserfiche and Workflow.  I have to jump into the deep end for my first project.  I am cleaning up a mess, and I can’t budget for Workflow add-ons this physical year.  I need to get this one project completed.

 

A program will drop files on a network share. 

     Example: \\parkvcapp\ProjectXfer

 

This is an example file name:
     PERMIT_CRW^1309050730020011_BRES2013-00102_Expired Letter Sample.pdf

 

My CRW (Import) Template is: CRW Import

   Fields:

  1. CRW Module
  2. CRW ID  (The leading CRW^ is trimmed off below)
  3. Permit #
  4. Document Type

 

I have written VBA code to:

  1. Access a UNC Folder
  2. Process each file in the folder
  3. Process each file name to extract the template info

 

Bradley Eudy has a nice piece of code showing how to use Document Importer at:

https://answers.laserfiche.com/questions/50749/import-document-ASPnet-Code

 

I still need some help using my code to bring the documents into Laserfiche and update the metadata (template).

 

Thank you in advance.

 

 

Code:

 

Option Explicit

Sub Iterate_Files()

Dim ctr As Integer
Dim i As Integer
Dim CRW_Module As String
Dim CRW_ID As String
Dim CRW_CASE_No As String
Dim CRW_Filename As String
Dim WrdArray() As String
Dim text_string As String
Dim Path As String
Dim File As String

ctr = 1
Path = "\\parkvcapp\ProjectXfer\"   
      ' Path should always contain a '\' at end
File = Dir(Path)    ' Retrieving the first entry.
Do Until File = ""   ' Start the loop.
'  text_string = Path & File  ' If path and file is needed.
  text_string = File
  WrdArray() = Split(text_string, "_")

      CRW_Module = WrdArray(0)
      CRW_ID = WrdArray(1)
      CRW_ID = Mid(CRW_ID, 5)   'Trims the "CRW^" off the ID
      CRW_CASE_No = WrdArray(2)
      CRW_Filename = WrdArray(3)

'  Tested in Excel, the following 4 lines are not used here.
'    ActiveSheet.Cells(ctr, 1).Value = CRW_Module 
'    ActiveSheet.Cells(ctr, 2).Value = CRW_ID     
'    ActiveSheet.Cells(ctr, 3).Value = CRW_CASE_No 
'    ActiveSheet.Cells(ctr, 4).Value = CRW_Filename

  ctr = ctr + 1
  File = Dir()   ' Getting next entry.
Loop
End Sub

 

 

 

0 0

Replies

replied on March 27, 2014

  Bradley's, not Brian's, code works with Document Importer.  I stated that I do not have a budget for addon's.  I know Workflow has a module (script) to use VB or C# code.

 

  Miruna, your response shows you put significant effort into your reply.  Thank you for your hard work on my behalf.

0 0
replied on March 27, 2014

Sorry, the name confusion was a typo. DocumentImporter is not an add-on to Workflow, I didn't realize that was what you were referring to when you mentioned add-ons. It is installed with Workflow 9.1 and higher as part of Laserfiche.DocumentServices and it can be added as a custom reference to script activities.

0 0
replied on March 26, 2014

Brian's sample code you linked above does both.

0 1
You are not allowed to follow up in this post.

Sign in to reply to this post.