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

Question

Question

VB.Net Repository Document Path

asked on July 27, 2022

Hi, 

 

I am attempting to get the file path for a document in the repository, but I get the error "no entry was specified". I was able to successfully run the code using a copy of the file in a windows folder, but I am unable to do the same with the file in the laserfiche directory. Any idea how to properly reference the document path in the repository? 

 


            DIM LF_DOCInfo as DocumentInfo = me.BoundEntryInfo
            dim sExt as String = LF_DOCInfo.Extension
            dim sDocName as String = LF_DOCInfo.Id & "_" & LF_DOCInfo.Name & "." & sExt
      

            Dim TextLine As String

            If System.IO.File.Exists( sDocName ) = True Then
                Dim objReader As New System.IO.StreamReader(sDocName)
                Do While objReader.Peek() <> -1
                    TextLine = TextLine & "|" & objReader.ReadLine() & vbNewLine

                    Loop

                Else
            End If

0 0

Answer

SELECTED ANSWER
replied on August 3, 2022

Update (in case anyone is interested), end up using the following solution. 

 

Created 2 different workflows to achieve what I ultimately wanted. Once the csv file is updated in the repository, the file is exported to temporarily to a windows folder; where data is extracted. Next, a second WF is invoked that read the csv data + adds the data to SQL db. Then finally deletes temp csv. 

 

 

0 0

Replies

replied on July 27, 2022 Show version history

System.IO.File.Exists is for files stored in the Windows file directory, but there's a big difference between the files and the Laserfiche documents in the repository.

A Laserfiche document can consist of many different files, such as the page images, the text files, and electronic files, all of which are bound together using the LF database, metadata, etc., so you can't just reference a windows file path to read the document contents.

It would help to know what you're trying to accomplish.

 

As for the "no entry was specified" error, that means you probably configure your SDK script activity to use the result of your search. It defaults to Starting Entry and what you set there is what determines the BoundEntryInfo object.

However, as I mentioned above that's not going to get things working the way you want.

 

EDIT: As Miruna pointed out, if you get the error while testing from the designer, it could be that you didn't select an entry in the script parameters.

1 0
replied on July 27, 2022

Are you getting that error when you run the script from the Designer or when your workflow runs?

 

1 0
replied on July 28, 2022

Hi, correct when I run it through the designer. In selected the search repository result as the default entry

 

0 0
replied on July 28, 2022

That's for when the workflow runs on the server. When testing from the Designer's script editor, you need to specify an entry in the Script Parameters dialog.

1 0
SELECTED ANSWER
replied on August 3, 2022

Update (in case anyone is interested), end up using the following solution. 

 

Created 2 different workflows to achieve what I ultimately wanted. Once the csv file is updated in the repository, the file is exported to temporarily to a windows folder; where data is extracted. Next, a second WF is invoked that read the csv data + adds the data to SQL db. Then finally deletes temp csv. 

 

 

0 0
replied on August 4, 2022

You're adding a step there that isn't really necessary. Exporting the file to a Windows directory means you can read it with System.IO, but you could do the same thing by reading it out to a stream.

Basically, instead of using the stream to save the file to the Windows folder, just feed that directly into the process that reads the data in the same script.

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

Sign in to reply to this post.