Lookup Connector [Deprecated]

Version 22.0.8473


Lookup Connector [Deprecated]


The Lookup Connector supports fetching a value from a data source and inserting it into an existing file.

Overview

A Lookup connector connects to a data source using the connection configuration of another connector in the CData Arc flow. When an input file is processed by the connector, the connector issues a custom query over the configured connection and stores the results in the processed file. These response values are inserted into the input file either as header values or as XML elements at a configured XPath.

Lookup connectors utilize caching to improve performance when repeatedly looking up values from a data source.

Connector Configuration

This section contains all of the configurable connector properties.

Settings Tab

Connector Configuration

Settings related to the core operation of the connector.

  • Data Source The connector that will be used to establish a connection to the data source. The Lookup connector will use this connector’s configuration to determine what data source to connect to, how to connect to it, and what credentials to use during the connection.

Lookup Settings

Settings related to the lookup query and how to interpret the response.

  • Connector Id The static name of the connector. All connector-specific files are held in a folder by the same name within the Data Directory.
  • Connector Description An optional field to provide free-form description of the connector and its role in the flow.
  • Destination Type Whether the query response should be inserted into the processed file as a header value or an XML element at a specified XPath.
  • Destination If Destination Type is set to XPath, this value is the XPath at which the lookup response value will be inserted into the input XML document. If Destination Type is set to Header, this value is the name of the header whose value will be set to the response value.
  • Lookup Query The query to execute against the data source. This query should fetch a value to be inserted into the input file. Values from the input file can be referenced in this query using the following syntax:

    ${XPATH:/path/to/element}
    OR
    ${HEADER:HeaderName}
  • Use first result When multiple results are returned from the Lookup Query, the Lookup connector can either throw an error or use the first result. Enable this field to use the first result instead of throwing an error.

Cache

Settings related to the cache maintained by the connector.

  • Enable Cache Whether the connector should maintain a cache to reduce the number of queries performed against the data source.
  • Cache Tolerance The duration that the cache will be used before the cache is refreshed against the data source. The unit of time for this field is governed by Cache Tolerance Unit.
  • Cache Tolerance Unit The unit of time for the Cache Tolerance field.
  • Reset Cache Automatically refreshes the cache by querying the data source.

Automation

Settings related to the automatic processing of files by the connector.

  • Send Whether messages arriving at the connector will automatically be processed.

Performance

Settings related to the allocation of resources to the connector.

  • Max Workers The maximum number of worker threads that will be consumed from the threadpool to process files on this connector. If set, overrides the default setting from the Profile tab.
  • Max Files The maximum number of files that will be processed by the connector each time worker threads are assigned to the connector. If set, overrides the default setting from the Profile tab.

Advanced Tab

Other Settings

Settings not included in the previous categories.

  • Local File Scheme A filemask for determining local file names as they are downloaded by the connector. The following macros may be used to reference contextual information:
    %ConnectorId%, %Filename%, %FilenameNoExt%, %Ext%, %ShortDate%, %LongDate%, %RegexFilename:%, %DateFormat:%.
    As an example: %FilenameNoExt%_%ShortDate%%Ext%
  • Log Subfolder Scheme Instructs the connector to group files in the Logs folder according to the selected interval. For example, the Weekly option instructs the connector to create a new subfolder each week and store all logs for the week in that folder. The blank setting tells the connector to save all logs directly in the Logs folder. For connectors that process many transactions, using subfolders can help keep logs organized and improve performance.
  • Log Messages Whether the log entry for a processed file will include a copy of the file itself.
  • Save to Sent Folder Whether files processed by the connector should be copied to the Sent folder for the connector.
  • Send Filter A glob pattern filter to determine which files in the Send folder will be processed by the connector (e.g. *.edi). Negative patterns may be used to indicate files that should not be processed by the connector (e.g. -*.tmp). Multiple patterns may be separated by commas, with later filters taking priority except when an exact match is found.

Miscellaneous

Settings for specific use cases.

  • Other Settings Allows configuration of hidden connector settings in a semicolon-separated list, like setting1=value1;setting2=value2. Normal connector use cases and functionality should not require use of these settings.

Example

Use Case

Imagine an invoice for a particular customer needs to be entered into QuickBooks. QuickBooks requires that an internal CustomerID field is included in order to insert the invoice, but only the customer name is known. A Lookup connector can be used to query QuickBooks for the CustomerID for a particular customer name and insert this into the invoice data. The invoice-plus-CustomerID can then be passed along to a QuickBooks connector for insertion.

Input File

A QuickBooks connector expects invoice data to be formatted as XML, so in this case it is likely that the invoice file being processed by the Lookup connector has already been converted into XML. The structure of this XML should be ‘flattened’ so that each value that should be inserted into QuickBooks is a child of a single insert element, like this:

<Items>
  <Invoices>
    <InvoiceNumber>123</InvoiceNumber>
    <Date>01012019</Date>
    <Amount>921.22</Amount>
    <Customer>Marshall Rosenberg</Customer>
  </Invoices>
</Items>

Configuration

A QuickBooks connector must already be configured to connect to QuickBooks with the appropriate credentials, and this connector should be set as the Data Source for the Lookup connector.

The Destination Type should be set to ‘XPath’ since the input file is XML and the lookup response data should be inserted into this XML.

The Destination field should be set to the XPath where the lookup value (CustomerID) will be appropriately included in the QuickBooks insert. For this example, assume that the current customer name in the Customer element should be replaced by the CustomerID. In this case, Destination should set to: /Items/Invoices/Customer

The Lookup Query should be set to return the CustomerID for a given customer name, for example: SELECT CustomerID FROM Customers WHERE CustomerName = ${XPATH:/Items/Invoices/Customer}

Result

With the above configuration, the Lookup connector will process the example input file and query QuickBooks for the CustomerID of ‘Marshall Rosenberg’. The ID returned by this query will replace ‘Marshall Rosenberg’ in the Customer element of the XML, then the resulting XML will be pushed to the Output/Receive folder of the connector.

Caching

By default, the Lookup Connector will maintain a local cache to improve performance when making repeated queries to the same data source. The behavior of this cache, including whether it is enabled, the duration of time before the cache is synchronized against the data source, etc, is controlled by the fields in the Cache section of the Settings tab.

When caching is enabled, lookup queries will be made against the local cache rather than the external data source. The exception to this is when the connector processes a complex query with syntax not supported by the local cache. In that case, the query will always be passed through to the remote data source. In these cases, it is recommended to disable caching altogether to avoid warnings in the connector (the connector will still process the query successfully even if the cache is enabled).