Lookup Scripts

The methods for lookup query and results processing are accessed through the LookupScript class. Lookup scripts are accessed on individual lookups defined on Advanced Indexing->Lookups->Add->Options->Miscellaneous. To enable scripting on individual lookups, check the "Enable Lookup Scripting" checkbox and press the Open Script Editor button.

LookupScript Class

ProcessPreviewQuery Method

The ProcessPreviewQuery method is called when running a preview of a Lookup query in Lookup configuration. It is called before the actual lookup runs to allow the Key values for the query to be manipulated. Return false from this method to stop the Lookup from running.

Parameters:

DirectionParameterTypeDescription
INlookupILookupDefinitionThe definition of the lookup being previewed
IN/OUTqueryIDictionary<string, object>The values for the Key Fields defined on the Lookup keyed by the Index Field name

Returns:

True or False

ProcessBatchRecordQuery Method

The ProcessBatchRecordQuery method is called when running a Lookup query for Batch level fields. It is called before the actual lookup runs to allow the Key values for the query to be manipulated. Return false from this method to stop the Lookup from running.

Parameters:

DirectionParameterTypeDescription
INbatchIBatchThe batch the lookup is being run on
lookupILookupDefinitionThe definition of the lookup being processed
IN/OUTqueryIDictionary<string, object>The values for the Key Fields defined on the Lookup keyed by the Index Field name

Returns:

True or False

ProcessFolderRecordQuery Method

The ProcessFolderRecordQuery method is called when running a Lookup query for Folder level fields. It is called before the actual lookup runs to allow the Key values for the query to be manipulated. Return false from this method to stop the Lookup from running.

Parameters:

DirectionParameterTypeDescription
INbatchIBatchThe current batch
folderIFolderThe folder the lookup is being run on
lookupILookupDefinitionThe definition of the lookup being processed
IN/OUTqueryIDictionary<string, object>The values for the Key Fields defined on the Lookup keyed by the Index Field name

Returns:

True or False

ProcessDocumentRecordQuery Method

The ProcessDocumentRecordQuery method is called when running a Lookup query for Document level fields. It is called before the actual lookup runs to allow the Key values for the query to be manipulated. Return false from this method to stop the Lookup from running.

Parameters:

DirectionParameterTypeDescription
INbatchIBatchThe current batch
folderIFolderThe current folder
documentIDocumentThe document the lookup is being run on
documentRecordIndexintThe index of the document record the lookup is being run on
lookupILookupDefinitionThe definition of the lookup being procesed
IN/OUTqueryIDictionary<string, object>The values for the Key Fields defined on the Lookup keyed by the Index Field name

Returns:

True or False

ProcessPreviewResults Method

The ProcessPreviewResults method is called after a preview of a Lookup query has been run in Lookup configuration. The results of the lookup are available in a DataTable object allowing the data to be manipulated before index fields are populated with the return fields. Return false from this method to clear the result set that gets sent back from the lookup.

Parameters:

DirectionParameterTypeDescription
INlookupILookupDefinitionThe definition of the lookup being previewed
queryIDictionary<string, object>The values for the Key Fields defined on the Lookup keyed by the Index Field name
IN/OUTresultsSystem.Data.DataTableThe query results

Returns:

True or False

ProcessBatchRecordResults Method

The ProcessBatchRecordResults method is called after a Lookup query has been run for Batch level fields. The results of the lookup are available in a DataTable object allowing the data to be manipulated before index fields are populated with the return fields. Return false from this method to clear the result set that gets sent back from the lookup.

Parameters:

DirectionParameterTypeDescription
INbatchIBatchThe batch the lookup was processed for
lookupILookupDefinitionThe definition of the lookup being processed
queryIDictionaryThe values for the Key Fields defined on the Lookup keyed by the Index Field name
IN/OUTresultsSystem.Data.DataTableThe query results

Returns:

True or False

ProcessFolderRecordResults Method

The ProcessFolderRecordResults method is called after a Lookup query has been run for Folder level fields. The results of the lookup are available in a DataTable object allowing the data to be manipulated before index fields are populated with the return fields. Return false from this method to clear the result set that gets sent back from the lookup.

Parameters:

DirectionParameterTypeDescription
INbatchIBatchThe current batch
folderIFolderThe folder the lookup was processed for
lookupILookupDefinitionThe definition of the lookup being procesed
queryIDictionaryThe values for the Key Fields defined on the Lookup keyed by the Index Field name
IN/OUTresultsSystem.Data.DataTableThe query results

Returns:

True or False

ProccessDocumentRecordResults Method

The ProcessDocumentRecordResults method is called after a Lookup query has been run for Document level fields. The results of the lookup are available in a DataTable object allowing the data to be manipulated before index fields are populated with the return fields. Return false from this method to clear the result set that gets sent back from the lookup.

Parameters:

DirectionParameterTypeDescription
INbatchIBatchThe current batch
folderIFolderThe current folder
documentIDocumentThe document the lookup was processed for
documentRecordIndexintThe index of the document record the lookup was processed for
lookupILookupDefinitionThe definition of the lookup being procesed
queryIDictionaryThe values for the Key Fields defined on the Lookup keyed by the Index Field name
IN/OUTresultsSystem.Data.DataTableThe query results

Returns:

True or False