Good Morning All,
I'm using the SDK and Visual Basic Studio 2013 to search for entries that have pre-determined field values for fields Case Number and Review Number. I followed the advice and suggestions in a previous post. and I'm placing my code at the bottom of this question.
My issue is that I am not getting any config errors from VB, but when the code runs it returns an error 9084. Unfortunately I cant use a track token as this process is being run from an externally created VB program using the RA programming settings.
The basic process for this evolution is that the user is able to take a csv or txt file and put in the following parameters.
1. Type of Export (PDF or TIF)
2. Case Number
3. Review Number
4. Path to export to
A typical row in the text file might look like this:
PDF, 123456789CN, 987654321RN, C:\Mypath
The program reads the file (It does this perfectly) then looks through the repository using the parameters: "{[]:[Case Number]=currentrow(1), [Review Number]=currentrow(2)} & {LF:Name=""*"", Type=""DB""}"
It then will create a PDF or TIF export of the document and then place it in the folder path.
When I run the debug it throws the error.
Best Regards,
Brian
*************************Code ************** Using myreader As New Microsoft.VisualBasic.FileIO.TextFieldParser("c:\1234.txt") myreader.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited myreader.Delimiters = New String() {",", "\n"} Dim currentrow As String() While Not myreader.EndOfData currentrow = myreader.ReadFields() MessageBox.Show(currentrow(0) & " Is the Doc type for this row") 'currentrow(0) is the Document type (PDF, TIF) 'currentrow(1) is the Case Number 'currentrow(2) is the Review number 'currentrow(3) is the path to place the file For Each currentfield In currentrow ' ******************* ' * ' * PDF ' * ' ****************** If currentrow(0) = "PDF" Then Try 'MessageBox.Show(currentrow(0) & " Made it through the PDF Eval. This is a " & currentrow(0) & "." & " I am supposed to put my stuff in folder " & currentrow(3)) ' Set up the variables needed to run the process Dim serverName As String = CMBLaserficheServerName.Text, repositoryName As String = CMBRepositoryName.Text Dim userName As String = CMBLaserficheRepositoryUserLogin.Text, userPassword As String = CMBLaserficheRepositoryUserPassword.Text Dim mySession As New Session Dim listing As New List(Of String) ' Logging into the Repository mySession.LogIn(userName, userPassword, New RepositoryRegistration(serverName, repositoryName)) Dim searchParameters As String = "{[]:[Case Number]=currentrow(1), [Review Number]=currentrow(2)} & {LF:Name=""*"", Type=""DB""}" Dim lfSearch As Search = New Search(mySession, searchParameters) Dim settings As SearchListingSettings = New SearchListingSettings Dim searchResults As SearchResultListing ' ** Dim targetFolder As String Dim filePathAndName As String ' What columns do you want the search to retrieve... settings.AddColumn(SystemColumn.Name) settings.AddColumn(SystemColumn.CreationDate) settings.AddColumn(SystemColumn.EntryType) settings.AddColumn(SystemColumn.Path) settings.AddColumn(fieldName:="Review Number") settings.AddColumn(fieldName:="Case Number") ' Have set up search parameters ' Run the search... lfSearch.Run() ' Searching the Repository for items that meet search criteria. ' Get the results... searchResults = lfSearch.GetResultListing(settings) ' If there are any results then step through them... ' 42120141600 If searchResults.RowCount > 0 Then ' 42120141600 For i As Integer = 1 To 1 'searchResults.RowCount ' Verifying directory ' Create the 'root directory from the textbox value... ' ** targetFolder = currentrow(3) & "\" & searchResults.GetDatumAsString(i, SystemColumn.Path) filePathAndName = currentrow(3) & "\" & searchResults.GetDatumAsString(1, SystemColumn.Name) & ".pdf" ' MessageBox.Show("This is supposed to be a " & currentrow(0) & "and is to be placed in " & currentrow(3)) VerifyDirectory(currentrow(3)) ' Step through the search results and create the subfolders in the root directory above... ' ** VerifyDirectory(targetFolder) ' Creating folder for this item. 'currentrow(0) is the Document type (PDF, TIF) 'currentrow(1) is the Case Number 'currentrow(2) is the Review number 'currentrow(3) is the path to place the file 'settings.AddColumn(fieldName:="Review Number") 'settings.AddColumn(fieldName:="Case Number") If currentrow(1) = settings.AddColumn(fieldName:="Case Number") Then Dim docInfo As DocumentInfo Dim docexporter As New DocumentExporter ' Creating PDF for this iteration / loop. 'Get a reference to the appropriate document... ' getting doc name, ID, and accessing my repository session docInfo = Document.GetDocumentInfo(searchResults.GetDatum(1, SystemColumn.Id), mySession) ' Checking to be sure the PDF has pages and text. If docInfo.AllPages.GetTotalPageCount > 0 Then ' Setting up the export. Document namne, PDF options (I want the text) docexporter.ExportPdf(docInfo, docInfo.AllPages, PdfExportOptions.IncludeText, filePathAndName) ' Small elay to stop COM error delay(3) ' PDF was fine so I created it! End If End If ' 42120141600 Next ' 42120141600 End If ' MessageBox.Show("I think I'm done with Row 1 since it was set up to be PDF") 'Cleanup... listing = Nothing lfSearch = Nothing settings = Nothing searchResults = Nothing mySession.Close() mySession = Nothing Catch ex As Exception MessageBox.Show(ex.Message) End Try End If End While End Using MessageBox.Show("ok")