Installation guide
Zetadocs for NAV Installation Guide
This edition 5
th
December 2012 © Copyright Equisys plc 2012 All trademarks acknowledged All rights
reserved
Page 83
// Make sure there are records to search through
IF Orders.FIND('-') THEN
BEGIN
//Loop through records until we find a matching one or reach the end
REPEAT
// Check if the order number can be found in the file
// NOTE: For this example we have changed the orders number
//series so order numbers will look like:
// "PO-00001" This should be unique in the file so we don't get
//false matches
IF IsValueInFile( Orders."No.",
ZdUtilities.GetExtractedTextFilePath(
ZdControlFile)) THEN
BEGIN
// We've found the right purchase order so return true
EXIT(TRUE);
END;
UNTIL Orders.NEXT = 0;
END;
// Reached the end of the orders without matching one, so return false
EXIT(FALSE);
}
Adjusting the GetAutoLink Function
Now we have created and added code to our variables we need to adjust the GetAutoLink function. This is
so it can look through all the Orders and find out if one of them matches up the Purchase Order number that
is present in the associated file being archived. Scroll to the GetAutoLink section and add the code so that it
surrounds the existing code as shown below.
CODE:
GetAutoLink (…)
{
ZdUtilities.Log(0, 'C9009964 - AutoLink');
CASE ZdArchiveContext."Zetadocs Doc. Queue No." OF
'ZDQ0020','ZDQ0021':
// Purchase Invoice and Purchase Receipt Document Queues
BEGIN
// Use the information in the control file to find a matching purchase order
IF GetMatchingPurchaseOrder(Orders, ZdControlFile) THEN
BEGIN
// use a RecordRef to get the record id for the matching record
RecRef.GETTABLE(Orders);
ZdLinkResult."Record ID" := RecRef.RECORDID;
ZdLinkResult.MODIFY;
END;
END
ELSE
BEGIN
...
<< EXISTING CODE HERE >>
...
END
EXIT;
}