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

Question

Question

Data will not export using RA SDK

asked on April 24, 2014 Show version history

 

Good Afternoon Everyone,

 

Issue
-----
Documents are not exporting, but folders ARE being created, and no errors are being thrown currently when used on client network. Program operates perfectly both in the VB NET 2013 Studio or via the executible package on my sandbox. Please see sections on Troubleshooting and Verification for further details.

 

Scenario:
----------
I've built a program that is designed to read an external txt file (or csv) and based on the info provided, search the repository for the specified item, then export it as whatever doc type was specified based on values provided.

 

Example:

 

Line 1 is:


PDF, 123456789, 987654, C:\Mypath

 

This would result in the search looking through the repository for any document with the field value for "Case Number" being equal to 123456789 or a field value for "Review Number" being equal to 987654. It then takes the found document and exports it as a PDF to C:\MyPath.


Environments
-------------

My sandbox environment:
-----------------------
Windows 7 Pro x64 SP1 VM Virtual Machine
4 GB Ram
80 GB HD
LF Client 9.1.x
LF Server 9.1.x
SQL 2012 Full
etc.

 

Clients Environment
-------------------
Workstation
----------------
Windows 7 Pro x64 SP1
4 GB Ram
500 GB HD
LF Client 9.1.x
etc.

 

 

Server
---------
Windows 2008 Standard x64
16 GB Ram
500 GB HD space
LF Server 9.1.x
etc.

 

 

SQL Server
----------------
Windows 2008 Standard x64
16 GB Ram
500 GB HD space
SQL 2008 R2


Verification
---------------
User account is a Named User
SDK Runtimes are installed on client server where the program is being run from.

 

Troubleshooting:
-----------------------
It is working perfectly in my sandbox running VB NET Studio 2013.using the debug process. The folders are being created correctly, the correct documents are exporting  properly into the correct folders, etc.

Complied and ran the setup and application and it also is working perfectly in my sandbox. The folders are being created correctly, the correct documents are exporting  properly into the correct folders, etc..

When installed and tested in the live environment, I'm not getting any errors, the folders DO create properly, but they remain empty. I am using the same documents, the same data file, etc.

 

Misc.
----
There is a template that has 2 fields one called "Case Number" and the other called "Review Number". The template name doesn't matter as I am only concerned with the fields.


Variables:
Currentrow(0)  ' Document type to extract as
Currentrow(1)  ' Case Number
Currentrow(2)  ' Review Number
Currentrow(3)  ' Output Path

 

 

The process that should be occurring is:

 

1. Application reads the .txt file, row by row

 

2. Depending on whether currentrow (0) (the current doc type to export) is set as PDF or TIF, the same process will be run except for the different requirements for a TIF vs a PDF.

 

3. The chosen path will search the repository and return the results that equal the currentrow(1) (Case Number) and the currentrow(2) (Review Number).

 

4. Based on the currentrow(0) a  file with the proper type is exported to a path supplied by Currentrow(3) (The path).

 

5. Everything repeats until there are no more rows of data.

 

6. Application notifies user of completion and closes down all sessions and activities.

 

 


Code is attached as is the txt file used.

 

A review of my code and processes would be appreciated and any info on what I' missing as well.

 

Regards,

 

' Run the search. 
lfSearch.Run()

' Get the results... 
searchResults = lfSearch.GetResultListing(settings)

' If there are any results then step through them... 
If searchResults.RowCount > 0 Then

    ' Search iterations to get the documents matching the criteria.
    For i As Integer = 0 To 1 'searchResults.RowCount

        ' The path and file name to create based on the search.
        filePathAndName = currentrow(3) & "\" & searchResults.GetDatumAsString(1, SystemColumn.Name) & ".pdf"

        ' Check to see if the direcotry exists. If not then create it.
        VerifyDirectory(currentrow(3))

        ' If a result is found then verify it matches the criteria for that 
        ' row in the lfexport.txt file.
        If currentrow(1) = searchResults.GetDatumAsString(1, "Case Number") Or currentrow(2) = searchResults.GetDatumAsString(1, "Review Number") Then

            ' Set up variables for export process.
            Dim docInfo As DocumentInfo
            Dim docexporter As New DocumentExporter

            ' Set up variable for this iteration  / loop. 
            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)

            End If
        End If
    Next
End If

'Cleanup... 
listing = Nothing
lfSearch = Nothing
settings = Nothing
searchResults = Nothing
mySession.LogOut()
mySession = Nothing

The above code is for the PDF export

 

' Run the search...
lfSearch.Run()

' Get the results...
searchResults = lfSearch.GetResultListing(settings)

' If there are any results then step through them...
If searchResults.RowCount > 0 Then
    For i As Integer = 0 To 1 ' searchResults.RowCount

        ' Setting the path and document name variables.
        filePathAndName = currentrow(3) & "\" & searchResults.GetDatumAsString(1, SystemColumn.Name) & ".tif"

        ' Check to see if the direcotry exists. If not then create it.
        VerifyDirectory(currentrow(3))

        ' If a result is found then verify it matches the criteria for that 
        ' row in the lfexport.txt file.
        If currentrow(1) = searchResults.GetDatumAsString(1, "Case Number") Or currentrow(2) = searchResults.GetDatumAsString(1, "Review Number") Then
            Dim docInfo As DocumentInfo
            Dim docexporter As New DocumentExporter

            ' Export Configuration settings for a tif
            docexporter.PageFormat = DocumentPageFormat.Tiff
            docexporter.IncludeAnnotations = True
            docexporter.BlackoutRedactions = True

            ' Set up variable for this iteration  / loop. 
            docInfo = Document.GetDocumentInfo(searchResults.GetDatum(1, SystemColumn.Id), mySession)

            ' Checking to be sure the Tif has pages and text.
            If docInfo.AllPages.GetTotalPageCount > 0 Then

                ' Setting up the export. 
                docexporter.ExportPages(docInfo, docInfo.AllPages, filePathAndName)
            End If
        End If
    Next
End If

The above is for TIFF export

 

Private Sub VerifyDirectory(ByVal folderPath As String)
    If Not Directory.Exists(folderPath) Then
        Directory.CreateDirectory(folderPath)
    End If
End Sub

The above is used for creating the folder if it doesn't exist

0 0

Answer

SELECTED ANSWER
replied on April 25, 2014

Follow up: I eliminated line

If currentrow(1) = searchResults.GetDatumAsString(1, "Case Number") Or currentrow(2) = searchResults.GetDatumAsString(1, "Review Number") Then

and the program now exports perfectly on the client system too. Any ideas why this string isn't working ? Essentially it is nothing more that a check and balance.

 

 

0 0
replied on April 25, 2014
We are unable to reproduce the problem that you are seeing, and can't find anything in your code to suggest what the problem is. You need to attach a debugger to the process and step through to check what is going on - the issue likely lies in your conditions rather than the Laserfiche calls. If, after debugging, you determine that the problem is external to your code, please post another question with a minimal, running example that reproduces your problem.
0 0

Replies

replied on April 24, 2014

Addendum:

 

For the fun of it, I added message boxes all along the process including reporting of variables and such. I then complied the app and installed it on the Client server and ran the process. It performed flawlessly, and reported everything as it should have including reporting the variables and conditions, etc also that that the file had been exported.

 

No file was exported though

 

- Brian

0 0
replied on April 24, 2014 Show version history

Add a call to docInfo.Refresh(False) after you initialize your docInfo variable. I think that your conditional is always false because your docInfo hasn't been updated to include its actual page count.

0 0
replied on April 24, 2014

Hi Mathew,

 

When I ran the installed app I was indeed getting false as the condition after

 ' Check to see if the direcotry exists. If not then create it.
 VerifyDirectory(currentrow(3))

but it was / is caused by the conditional

If currentrow(1) = searchResults.GetDatumAsString(1, "Case Number") Or currentrow(2) = searchResults.GetDatumAsString(1, "Review Number") Then
22	 

I have a message box reporter that is reporting exact page counts being seen.

 

If docInfo.AllPages.GetTotalPageCount > 0 Then

 MessageBox.Show("There were more than 0 pages in the document: " & docInfo.AllPages.GetTotalPageCount)

 

In the sample it was seeing 4 pages as it should, and reporting 4 pages.

 

I'll try adding your idea and see what happens.

 

Thanks!

Brian

0 0
replied on April 25, 2014

Mathew,

 

Same result. No change. Documents do not export.

 

Regards,

Brian

0 0
replied on April 25, 2014

Brian,

 

We are unable to reproduce the problem that you are seeing, and can't find anything in your code to suggest what the problem is. You should attach a debugger to the process and step through to check what is going on - the issue likely lies in your conditionals rather than the Laserfiche calls. If, after debugging, you determine that the problem is external to your code, please post another question with a minimal, running example that reproduces your problem.

You are not allowed to follow up in this post.

Sign in to reply to this post.