# PILookup

## Program ID

MetraPipeline.PILookup.1

## Description

The PILookup plug-in determines the product offering ID and priceable item instance ID for the given session. This plug-in uses the account's subscription data and all relevant effective date information to figure out which product offering the transaction belongs to as well as which priceable item instance.

The PILookup plug-in is not required to run before the PCRate plug-in.

By default, the plug-in uses a set of reserved properties. These properties can optionally be overridden.

PILookup's properties are expected in the following order: _Timestamp, _PriceableItemName, _AccountID, _AccountPriceList, _PriceableItemInstanceID, _ProductOfferingID, _SubscriptionID, _PriceableItemTemplateID.

## Required Input Properties

The names of the properties may be overridden (see Configuration Example).

Property | Data Type | Description
_timestamp | datetime | Timestamp used as the effective date for this session.
_PriceableItemName | string | The name of the priceable item template. Either this property or _PriceableItemTemplateID must be set.
_PriceableItemTemplateID | long | ID of the priceable item template. Either this property or _PriceableItemName must be set.
_AccountID | long | The account ID associated with the session.

## Required Output Properties

The names of the properties may be overridden (see Configuration Example).

Property | Data Type | Description
_PriceableItemInstanceID | long | The ID of the priceable item instance..
_PriceableItemTemplateID | long | The priceable item template ID (set if PriceableItemName is passed in to identify the priceable item template).
_ProductOfferingID | long | The ID of the product offering.
lookupbyid | boolean | If this property is TRUE: The template ID is the basis of the lookup (rather than the priceable item's name) PriceableItemTemplateID is required. If this property is FALSE: _PriceableItemName is required.
_SubscriptionID | long | This configuration tag allows you to override the property that is set with the resolved subscription ID. This value may be placed after the _ProductOfferingID (although all tags in this plug-in are optional).

## Additional Configuration Tags

Property | Data Type | Description
usebcpflag | BOOLEAN | If using a SQL Server database, when TRUE, this plug-in uses the SQL Server Bulk Copy Program (BCP) utility to insert temporary data into the database. (This increases the performance of this plug-in.) If Oracle is used, this tag is ignored. This property defaults to TRUE.

## Configuration example

There is no required configuration:

<configdata>
</configdata>

The LookupByID tag is optional. If it is FALSE, the plug-in will not attempt to use the priceable item template ID, only the name. Any number of reserved properties can also be overridden. All tags must be in the order specified but any or all can be omitted.

<configdata>
<!-- if false, don't attempt to lookup by ID, only by name -->
<LookupByID ptype="BOOLEAN">TRUE</LookupByID>

<!-- properties to use instead of normal reserved properties -->
<_Timestamp>_Timestamp</_Timestamp>
<_PriceableItemName>_PriceableItemName</_PriceableItemName>
<_AccountID>_AccountID</_AccountID>
<_AccountPriceList>_AccountPriceList</_AccountPriceList>
<_PriceableItemInstanceID>_PriceableItemInstanceID</_PriceableItemInstanceID>
<_ProductOfferingID>_ProductOfferingID</_ProductOfferingID>
<_SubscriptionID>_SubscriptionID<_SubscriptionID>
<_PriceableItemTemplateID>_PriceableItemTemplateID</_PriceableItemTemplateID>
</configdata>

## Remarks

In the future, the PCRate plug-in will set the priceable item instance ID and product offering ID, making this plug-in unnecessary in most cases. This plug-in is still useful when no rate lookup is required (for example, the first pass stage of an aggregate rated priceable item's pipeline).