73
Zetadocs for NAV Installation Guide
This edition 23rd July 2013 © Copyright Equisys Ltd 2013 All trademarks acknowledged All rights reserved
Page 71
o
Use of the barcode to identify and process the document requires customization work by
the VAR using the Zetadocs for NAV Capture SDK, as described below.
Note: This method works for most reports; however, due to the customizable nature of reports it may not fit
all reports exactly. Therefore, the location of where to insert the code below may need to vary but the code
will remain the same.
Installation Overview
In this section we write the code to enable document auto linking and archiving. You will need to modify the
printed report to include a barcode and there are also a number of functions that Zetadocs calls from the
Zetadocs-Capture Customize codeunit that you need to implement. The steps to follow are:
Installing the barcode font
Modify a report to add a barcode
Write code in the GetLinkDisplayString function
Write code in the GetAutoLink function
Test document auto linking
The following sections provide more detail on each step.
12.1
Installing the barcode font
Barcodes can be added to reports by simply using a suitable font. The chosen barcode font must be
installed on each client PC that will be used to print the report. There are many different types of barcode
font available, but we have found that Code 39 barcodes work well with Zetadocs. You can download and
install a free Code 39 barcode font from http://www.barcodesinc.com/free-barcode-font/. Choose either
the standard or extended font and follow the included instructions to install the font on each client PC.
Barcode fonts often have limited character support e.g. A-Z and 0-9. So please ensure that the characters
you wish to use are supported by the font.
12.2
Modify an NAV report to add a barcode
Before you modify your report, you need to decide what unique piece of information you will use for the
barcode, so that the printed report can subsequently be identified in the capture stage. This will usually be
the record number of the NAV record. For example for the Shipment Note report you could use the
Shipment record number from the Posted Sales Shipment Record.
Follow these instructions to modify a report to add a barcode:
Open the NAV Development Environment/classic client and open the Object Designer (Shift+F12).
Locate the report you wish to modify in the Object Designer and select Design.
In the Report Designer select ViewSections.
Open the toolbox ViewToolbox.
Select the text box tool and create one in a suitable location for the barcode - we suggest the main
header section.
Right-click on the text box and select properties.
Set the text box FontName to the barcode font name
e.g. FontName = Free 3 of 9 Extended
Edit the FontSize to a suitable value, we recommend a minimum size of 32.
Set the text box SourceExpr property to the value to be used for the barcode
e.g. SourceExpr = STRSUBSTNO('*SHIP%1*',"Sales Shipment Header"."No.")
Ensure that the barcode starts with and ends with “*”, otherwise the barcode will not be
recognized by the scanner.
We also suggest that you add another text box below the barcode to display the value in a
standard font so that it is also human readable.
Save the changes to the report.
Test that the report prints OK and that the barcode is clearly legible.
If you are using the Role Tailored Client, then make the equivalent changes in the report editor for the RTC
report.
Pdf metadata online - add, remove, update PDF metadata in C#.net, ASP.NET, MVC, Ajax, WinForms, WPFAllow C# Developers to Read, Add, Edit, Update and Delete PDF Metadata
remove pdf metadata; remove metadata from pdf online Pdf metadata online - VB.NET PDF metadata library: add, remove, update PDF metadata in vb.net, ASP.NET, MVC, Ajax, WinForms, WPFEnable VB.NET Users to Read, Write, Edit, Delete and Update PDF Document Metadata
remove metadata from pdf file; modify pdf metadata
69
Zetadocs for NAV Installation Guide
This edition 23rd July 2013 © Copyright Equisys Ltd 2013 All trademarks acknowledged All rights reserved
Page 72
12.3
Adding code to the GetLinkDisplayString function
Zetadocs calls the function GetLinkDisplayString to allow you to return a suitable text string to be
displayed in the document queue form. If no value is returned by this function, then the display will default
to the barcode text for the first barcode found in the captured document. If the document contains multiple
barcodes, these will be represented as multiple records in the table.
The GetLinkDisplayString function has the following parameters:
Parameter
Type
Sub-type
Read/Write
Description
ZdDocQueueBarcodes
Record
Zetadocs
Doc. Queue
Barcodes
Read
A read only runtime table that
allows you to access the values of
all barcodes from the document
queue item.
Return Value
Text[120]
Write
The text to display in the
document queue “Link” column.
Open the NAV Development Environment/classic client and open the Object Designer (Shift+F12).
Locate the Codeunit ID:9009964 Zetadocs-Capture Customise in the Object Designer and select
Design.
Scroll down to the GetLinkDisplayString section.
You will notice the code matches that displayed below, this indicates that it is setup for the
Shipment Report, which we provide as a sample report.
To add support for other reports we need to add additional if statements to ensure your system is
configured to deal with barcodes which start with other details.
Sample Code:
This sample code shows an implementation of GetLinkDisplayString that returns a display string for a
Shipment record.
// Call reset to clear any filters that may be on the barcodes temporary table
ZdDocQueueItemBarcodes.RESET;
IF NOT ZdDocQueueItemBarcodes.FIND('-') THEN
BEGIN
// There are no barcodes so we leave the link string blank
EXIT('');
END;
info := ZdDocQueueItemBarcodes.Value;
// if the barcode starts with SHIP
IF (STRLEN(info) > 4) AND (COPYSTR(info, 1, 4) = 'SHIP') THEN
BEGIN
info := STRSUBSTNO(strSalesShipment, COPYSTR(info, 5));
END;
END;
Customising the GetLinkDisplayString function
The document specific section of code below contains an IF statement which enables the codeunit to add
additional information to the document queue when it detects a barcode which begins with SHIP. The
makeup of this string is obviously determined by the unique value you wish to use for your barcode.
String in the report which generates the barcode
SourceExpr = STRSUBSTNO('*SHIP%1*',"Sales Shipment Header"."No.")
This would for example generate a value of *SHIP 102028*.
Corresponding code required in the codeunit
// if the barcode starts with SHIP
76
Zetadocs for NAV Installation Guide
This edition 23rd July 2013 © Copyright Equisys Ltd 2013 All trademarks acknowledged All rights reserved
Page 73
IF (STRLEN(info) > 4) AND (COPYSTR(info, 1, 4) = 'SHIP') THEN
BEGIN
info := STRSUBSTNO(strSalesShipment, COPYSTR(info, 5));
END;
The code then detects that our barcode starts with SHIP and acts accordingly.
Adding additional IF statements for other reports
If then you wanted to add barcode support to another report then you would need to modify the report as
per the steps in section 12.2 adding the SourceExpr value shown below. Note you can use whatever
identifier seems appropriate in this case we have chosen to setup a Sales Invoice report so have chosen
SINV and have replaced Sales Shipment Header for Sales Invoice Header.
SourceExpr = STRSUBSTNO('*SINV%1*',"Sales Invoice Header"."No.")
We then need to add an additional if statement to match this:
// if the barcode starts with SINV
IF (STRLEN(info) > 4) AND (COPYSTR(info, 1, 4) = ' SINV ') THEN
BEGIN
info := STRSUBSTNO(strSalesInvoice, COPYSTR(info, 5));
END;
This can be repeated as desired for any remaining reports.
12.4
Write code in the GetAutoLink function
Zetadocs calls the function GetAutoLink for each item in the queue so that you can determine if it can be
automatically associated with a NAV record. Details of recognized barcodes are included so that you can
write any necessary functionality to lookup the NAV record. If you plan to have this function called
automatically from the NAS server or from other codeunits, it is recommended that you do not include user
input operations.
The GetAutoLink function has the following parameters:
Parameter
Type
Sub-type
Read/Write
Description
ZdArchiveContext
Record
Zetadocs
Archive
Context
Read
A read only runtime table to
provide context information like
the queue the item is in and the
menu item that was clicked by the
user.
ZdDocQueueBarcodes
Record
Zetadocs
Doc. Queue
Barcodes
Read
A read only runtime table that
allows you to access the values of
all barcodes from the document
queue item.
ZdLinkResult
Record
Zetadocs
Link Result
Read/Write
A writable runtime table to allow
you to return the un-typed
RecordID reference to a NAV
record, error states and
messaging.
ZdControlFile
Text
[250]
Read
Path to the DQF file for the
document queue item (XML file).
Provided to allow you to fetch
other information about converted
files.
Sample Code:
This sample code shows an implementation of GetAutoLink that finds and returns the matching record ID.
54
Zetadocs for NAV Installation Guide
This edition 23rd July 2013 © Copyright Equisys Ltd 2013 All trademarks acknowledged All rights reserved
Page 74
PROCEDURE GetAutoLink@1000000006(ZdArchiveContext@1000000002 : Record 9009992;VAR
ZdLinkResult@1000000001 : Record 9009997;ZdControlFile@1000000000 : Text[250];VAR
ZdDocQueueBarcodes@1000000003 : Record 9009995);
VAR
msgNoBarcodes@1000000005 : TextConst 'DAN=Auto linking failed. No barcodes were detected on the
document.;DEU=Auto linking failed. No barcodes were detected on the document.;ENU=Auto linking failed. No barcodes
were detected on the document.;ESP=Auto linking failed. No barcodes were detected on the document.;FRA=Auto linking
failed. No barcodes were detected on the document.;ITA=Auto linking failed. No barcodes were detected on the
document.;NLD=Auto linking failed. No barcodes were detected on the document.;ENG=Auto linking failed. No barcodes
were detected on the document.';
msgCouldNotFindRecord@1000000006 : TextConst 'DAN=Auto linking failed. Could not find record matching barcode:
%1;DEU=Auto linking failed. Could not find record matching barcode: %1;ENU=Auto linking failed. Could not find record
matching barcode: %1;ESP=Auto linking failed. Could not find record matching barcode: %1;FRA=Auto linking failed.
Could not find record matching barcode: %1;ITA=Auto linking failed. Could not find record matching barcode:
%1;NLD=Auto linking failed. Could not find record matching barcode: %1;ENG=Auto linking failed. Could not find record
matching barcode: %1';
barcodeVal@1000000004 : Text[80];
ShipmentRec@1000000007 : Record 110;
RecRef@1000000008 : RecordRef;
BEGIN
ZdUtilities.Log(0, 'C9009964 - AutoLink');
This code should be the same for every report and doesn’t need repeating with each if statement.
// Use the barcodes that are passed in to find the record to link to.
// Call reset to clear any filters that may be on the barcodes temporary table
ZdDocQueueBarcodes.RESET;
IF NOT ZdDocQueueBarcodes.FIND('-') THEN
BEGIN
// There are no barcodes so don't modify the record.
// Processing will fall back to calling the Link function for the manual method.
EXIT;
END;
barcodeVal := ZdDocQueueBarcodes.Value;
IF Statement
// If the barcode starts with SHIP it means it is a shipment note.
// The barcode will be in the format SHIP000000, where 000000 is the shipment number
IF (STRLEN(barcodeVal) > 4) AND (COPYSTR(barcodeVal, 1, 4) = 'SHIP') THEN
BEGIN
ShipmentRec.RESET;
ShipmentRec."No." := COPYSTR(barcodeVal, 5);
// If we can find the record that the barcode refers to
IF ShipmentRec.FIND THEN
BEGIN
// if the user selected a record use a RecordRef to get the RecordID for the record
// and modify the ZdLinkResult record to include it
RecRef.GETTABLE(ShipmentRec);
ZdLinkResult."Record ID" := RecRef.RECORDID;
ZdLinkResult.MODIFY;
END;
END;
EXIT;
END;
78
Zetadocs for NAV Installation Guide
This edition 23rd July 2013 © Copyright Equisys Ltd 2013 All trademarks acknowledged All rights reserved
Page 75
Modified IF Statement for the Sales Invoice
// If the barcode starts with SINV it means it is a Sales Invoice.
// The barcode will be in the format SINV000000, where 000000 is the Sales Invoice number
IF (STRLEN(barcodeVal) > 4) AND (COPYSTR(barcodeVal, 1, 4) = 'SINV') THEN
BEGIN
ShipmentRec.RESET;
ShipmentRec."No." := COPYSTR(barcodeVal, 5);
// If we can find the record that the barcode refers to
IF ShipmentRec.FIND THEN
BEGIN
// if the user selected a record use a RecordRef to get the RecordID for the record
// and modify the ZdLinkResult record to include it
RecRef.GETTABLE(ShipmentRec);
ZdLinkResult."Record ID" := RecRef.RECORDID;
ZdLinkResult.MODIFY;
END;
END;
EXIT;
END;
Test document auto linking
At this stage you should test that the functionality you have added works by doing the following:
Print a modified report that includes a barcode.
Scan the printed report into your new document queue.
Check that the document is listed in the document queue within NAV and can be viewed correctly.
Check that the scanned document displays the appropriate text in the Link column.
Click the Archive button and complete the actions.
Browse to the SharePoint library and check that the document has been archived successfully in
the correct location.
View the document properties in SharePoint and check these are as expected.
(Finally, when you have completed your testing delete any test documents from the SharePoint
archive.)
12.5
Further Capture Customizations
Overview
In this section a number of advanced functions are described that will help you to do further customisation
of the document queue capture process. The functions available are:
PreArchive
PostArchive
PreArchive
The PreArchive function is similar to the OverrideSendResult function in the delivery parts of the Zetadocs
SDK. This function gives a writable copy of the final information to be used in the archiving of the document
from the queue. It is at this point that you get the opportunity to override the archive location and content
type.
The PreArchive function has the following parameters:
Parameter
Type
Sub-type
Read/Write
Description
ZdArchiveContext
Record
Zetadocs
Archive
Context
Read
A read only runtime table to
provide context information like
the queue the item is in and the
menu item that was clicked by the
user.
ZdArchiveSettings
Record
Zetadocs
Read/Write
A writable runtime table to allow
64
Zetadocs for NAV Installation Guide
This edition 23rd July 2013 © Copyright Equisys Ltd 2013 All trademarks acknowledged All rights reserved
Page 76
Parameter
Type
Sub-type
Read/Write
Description
Archive
Settings
you to modify properties of the
archive action such as whether to
archive and the archive location.
PostArchive
Zetadocs calls the PostArchive function to inform you of the archiving result and to allow you to implement
workflow based on that information.
The PostArchive function has the following parameters:
Parameter
Type
Sub-type
Read/Write
Description
ZdArchiveContext
Record
Zetadocs
Archive
Context
Read
A read only runtime table to
provides context information like
the queue the item is in and the
menu item that was clicked by the
user.
ZdArchiveResult
Record
Zetadocs
Archive
Result
Read/Write
A writable runtime table to allow
you to find out if the archive was
successful and get the URL of the
archived file.
12.6
Capture Reference
Overview
This section gives details of the records used by the capture functions:
Zetadocs Archive Context
Zetadocs Archive Metadata
Zetadocs Archive Result
Zetadocs Archive Settings
Zetadocs Doc. Q. Item Barcode
Zetadocs Link Result
Zetadocs Archive Context
Figure 26 - Zetadocs Archive Context Table
The Zetadocs Archive Context table has the following fields:
No.: Table record entry - please ignore
38
Zetadocs for NAV Installation Guide
This edition 23rd July 2013 © Copyright Equisys Ltd 2013 All trademarks acknowledged All rights reserved
Page 77
Zetadocs Doc. Queue No. : Foreign Key to Zetadocs Document Queue table to allow you to know
from which document queue the Link function has been called.
Menu Code ID: Foreign Key to Zetadocs Document Queue Menu Item No. table to allow you to
know which menu item had been selected by the user. Blank if used with GetAutoLink function.
UIEnabled: Indicates whether UI (User Interface) dialogs should be shown or suppressed.
Zetadocs Archive Metadata
Figure 27 - Zetadocs Archive Metadata Table
The Zetadocs Archive Metadata table has the following fields:
Name: Archive column name in SharePoint
Value: The metadata value expressed as a string
Type: The metadata type. Available types are NUMBER, DATE and STRING.
Zetadocs Archive Result
Figure 28 - Zetadocs Archive Result Table
The Zetadocs Archive Result table has the following fields:
No.: Table record entry - please ignore
Record ID: Un-typed record ID of the NAV record that the captured document is associated with.
Archive Document: Indicates if the captured document is to be archived to SharePoint
Archive Location: The URL of the archived document in SharePoint.
Archive Succeeded: Indicates if the archive was successful.
Delete After: Indicates if the document should be deleted
Show Delete Confirmation: Indicates to Zetadocs whether prompt the user for confirmation of
delete.
36
Zetadocs for NAV Installation Guide
This edition 23rd July 2013 © Copyright Equisys Ltd 2013 All trademarks acknowledged All rights reserved
Page 78
Error: Indicates to Zetadocs whether an error occurred during the function.
Error Description: A description of the error that occurred.
Stop Batch Processing: Used only when auto linking where this Boolean indicates whether batch
processing should stop or continue.
Additional Param: Additional parameter to allow extra data to be passed between Zetadocs
functions.
Zetadocs Archive Settings
Figure 29 - Zetadocs Archive Settings Table
The Zetadocs Archive Settings table has the following fields:
No.: Table record entry - please ignore
Record ID: Un-typed record ID of the NAV record that the captured document is associated with.
Archive Document: Indicates if the captured document is to be archived to SharePoint
Archive Location: The location to archive the document to in SharePoint.
Archive Document Type: The SharePoint content type to be used when archiving.
Error: Indicates to Zetadocs whether an error occurred during the function.
Error Description: A description of the error that occurred.
Stop Batch Processing: Used only when auto linking where this Boolean indicates whether batch
processing should stop or continue.
Additional Param: Additional parameter to allow extra data to be passed between Zetadocs
functions.
31
Zetadocs for NAV Installation Guide
This edition 23rd July 2013 © Copyright Equisys Ltd 2013 All trademarks acknowledged All rights reserved
Page 79
Zetadocs Doc. Q. Item Barcode
Figure 30 - Zetadocs Doc. Q. Item Barcode Table
The Zetadocs Doc. Q. Item Barcode table has the following fields:
No.: Table record entry - please ignore
Value: The barcode expressed as a string
Page: The page number the barcode was on
Zetadocs Link Result
Figure 31 - Zetadocs Link Result Table
The Zetadocs Link Result table has the following fields:
No.: Table record entry - please ignore
Record ID: Un-typed record ID of the NAV record that the captured document is associated with.
Error: Indicates to Zetadocs whether an error occurred during linking.
Error Description: A description of the error that occurred.
Stop Batch Processing: Used only when auto linking where this Boolean indicates whether batch
processing should stop or continue.
Cancel: Indicates whether the Archive action should be cancelled.
Additional Param: Additional parameter to allow extra data to be passed between Zetadocs
functions.
56
Zetadocs for NAV Installation Guide
This edition 23rd July 2013 © Copyright Equisys Ltd 2013 All trademarks acknowledged All rights reserved
Page 80
13.
Automation using Extracted Text
Now that we have covered how you can use barcodes to automate some of your processes, we are going to
demonstrate how text extraction on document capture can be used to add yet further automation. This
section will deal with how to extract the text from a captured document and then an example of how this
can be used to automate processes.
13.1
Enabling Zetadocs Document Capture Text Extraction
Zetadocs Capture Plus supports the parsing of document text, this can be used for identification numbers
and metadata to facilitate document recognition. This then allows the automated linking and archiving of
documents with NAV records. Implementing automated document recognition has many benefits including
the streamlining of processes, by the automation of tedious repetitive activities and by automatically
initiating internal workflows. To access this functionality you must enable text extraction on Zetadocs
Document Queues configurations in the Zetadocs Server and then use a Zetadocs for NAV SDK function to
get the path to the extracted text file.
Enabling text extraction in the Zetadocs Server
Each configured queue in the Zetadocs Server can have text extraction enabled independently. This allows
you to enable text extraction processing on the queues in which you expect to implement document
recognition. Furthermore it means that the unnecessary processing of documents is avoided. It is therefore
recommended that you create separate queues for documents for which you intend to implement document
recognition and for those you do not.
Configuring the Zetadocs Server
The image below shows a sample Zetadocs Server config.xml file. Note the element
<EnablePDFTextExtractionToFile> on each queue <DocsQ>.
To enable text extraction set the value of the xml element to true to enable text extraction. NOTE: Due to
xml serialization the value is case sensitive and must be set to true or false. True or TRUE or any other
variation will be invalid.
<?xml version="1.0" encoding="utf-8"?>
<Config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<docsQueue>
<DocsQ Description="Sales Document Queue" Location="\\User specified queue location\Sales Document Queue\">
<EnablePDFTextExtractionToFile>false</EnablePDFTextExtractionToFile>
<BatchScanSplitType>Barcode</BatchScanSplitType>
<BatchScanPageInterval>1</BatchScanPageInterval>
<BatchScanBarcodePrefix></BatchScanBarcodePrefix>
<BatchScanBarcodeDeleteSplitPage>false</BatchScanBarcodeDeleteSplitPage>
</DocsQ>
<DocsQ Description="Purchase Document Queue" Location="\\User specified queue location\Purchase Document
Queue\">
<EnablePDFTextExtractionToFile>false</EnablePDFTextExtractionToFile>
<BatchScanSplitType>Off</BatchScanSplitType>
<BatchScanPageInterval>1</BatchScanPageInterval>
<BatchScanBarcodePrefix></BatchScanBarcodePrefix>
<BatchScanBarcodeDeleteSplitPage>false</BatchScanBarcodeDeleteSplitPage>
</DocsQ>
</docsQueue>
<PDFQuality>Better</PDFQuality>
<EnableAbbyy>true</EnableAbbyy>
<StellentTimeOut>10</StellentTimeOut>
<StellentBypassPDF>true</StellentBypassPDF>
<LogLevel>Error</LogLevel>
<LogToFile>true</LogToFile>
<LogToEventLog>false</LogToEventLog>
Documents you may be interested
Documents you may be interested