FNP8_SearchAndDownload

Executes a search for documents in FileNet P8 and downloads the content of the documents.

Syntax

bool FNP8_SearchAndDownload()

Parameters

Uses the parameters set in the FNP8_SetSearch* methods for executing the search against FileNet P8 repository.

Returns

False if the actions FNP8_SetURL, FNP8_Login, FNP8_SetTargetObjectID, FNP8_SetSearchClass, and FNP8_SetSearchDownloadDir are not successfully called before this action. Otherwise, True.

Level

All levels.

Details

Executes a search for documents in FileNet P8 and downloads the content of the documents that are returned by the search.

By default, the maximum number of search results is limited to 1000 documents. Use the action FNP8_SetSearchMaxItems to set a different maximum limit.

The user or process that executes the action must have 'write' permissions for the directory. If a file exists in the directory with the same name as the content that gets downloaded, the existing file gets overwritten. After FNP8_SearchAndDownload has downloaded the FileNet P8 content files, scan() action can be called to read the files from the same directory.

Important: To prevent downloading duplicate item content, the task that calls FNP8_SearchAndDownload action should not be run in a multi-threaded configuration. Instead, use single-threaded tasks. For information about configuring threads in Rulerunner, see ../com.ibm.dc.install.doc/dcain403.htm.
Important: FNP8_SearchAndDownload () is enhanced to support the downloading of the content of the document that contains illegal characters such as \/:*?",.| in its name.
Instructions to download the content of the document that contains illegal characters:
  1. Open the application in Datacap Application Manager.
  2. Under the Custom Values tab, General string values section, create a new value name, cpeSanitizeFilename and assign its value as True.

The following actions are required to be called before you call FNP8_SearchAndDownload.

The following actions can optionally be called before you call FNP8_SearchAndDownload.

Important: Use the following actions to filter the documents that are to be downloaded by the FNP8_SearchAndDownload action.
Example 1
FNP8_SetURL("http://myp8server:9080/wsi/FNCEWS40MTOM/")
FNP8_Login("User1,Password1")
FNP8_SetTargetObjectID("AP_ObjectStore")
FNP8_SetSearchClass("Invoice")
FNP8_SetSearchDownloadDir("@APPPATH(vscanimagedir)")
FNP8_SetSearchWhereClause("DocumentTitle LIKE '2017-Invoices%'")
FNP8_SetSearchMaxItems(“100”)
FNP8_SetSearchOrderBy("InvoiceDate ASC“)
FNP8_SearchAndDownload()
Scan()
In this example following tasks are performed -
  • It searches for documents of class "Invoice" that have a property DocumentTitle, that matches the wildcard string '2017-Invoice%'.
  • It sorts the results in ascending order based on the InvoiceDate property.
  • It takes the top 100 results and downloads the contents of those documents to the directory specified in the Smart Parameter for the VScan image directory.

The output file name is a concatenation of the FileNet P8 item ID and the name of original content file uploaded (if it exists). If the original file name does not exist, then the default file extension would be .tif if the mime type of the content is image/tiff An example of the filename is {3054025F-0000-CE12-B41A-7B2661D28802}.Flight1.tif..

When the Scan() action runs, the action checks the populated image directory, and processes as usual.

Example 2
FNP8_SetURL("http://myp8server:9080/wsi/FNCEWS40MTOM/")
FNP8_Login("User1,Password1")
FNP8_SetTargetObjectID("AP_ObjectStore")
FNP8_SetSearchClass("Invoice")
FNP8_SetSearchDownloadDir("@APPPATH(vscanimagedir)")
FNP8_SetSearchWhereClause("DocumentTitle LIKE '2017-Invoices%'")
FNP8_SetSearchMaxItems(“100”)
FNP8_SetSearchAndDownloadStatusProperty("myStatusProp")
FNP8_SearchAndDownload()
Scan()

This example is similar to earlier one. However, the main differences are as follows -

  1. For each document that is downloaded, the property myStatusProp of the document is set to a value of 1.
  2. During document search, the documents that have myStatusProp=1 are excluded from the search.