# WriteProductView

## Program ID

MetraPipeline.WriteProductView.1

## Description

The WriteProductView plug-in writes sessions to the database, usually at the end of pipeline processing. The WriteProductView plug-in is typically in the WriteProductView stage, but can be included in other stages. The WriteProductView plug-in is usually the last plug-in to run in the last stage for the session.

If the WriteProductView plug-in is not included in the pipeline configuration file, sessions are not added to the database.

Each session has an associated product view in the database. Each product view in the database is identified by the session’s _ProductViewID property. The WriteProductView plug-in reads the properties in the product view of the session. The following properties in the session must be set. Underscores (_) indicate that the property name is reserved by the Pipeline server.

For more information about WriteProductView, see the Platform Programmers Guide.

Note: This plug-in is not backward compatible with the pre-2.2 WriteProductView configuration file.

Note: This plug-in is transactional, and accommodates MetraNet's session sets functionality. If transactional processing is used, the staging database must be specified (using the <stagedatabase> tag).

## Required Properties

Property | Description
_IntervalID | The unique ID identifying a billing cycle time span.
_Amount | The amount calculated by the processing of the session by the pipeline. The amount can be negative to represent a credit.
_ProductViewID | The identifier of the session’s product view.

## Optional Properties

Property | Description
_Currency | The units of the _Amount property. This property holds the ISO code for the currency. The default value is USD (U.S. dollars).
_FedTax | The amount of Federal tax in the currency specified in the _Amount property. The default value is 0.0.
_StateTax | The amount of state tax in the currency specified in the _Amount property.
_CountyTax | The amount of county tax in the currency specified in the _Amount property. The default value is 0.0.
_LocalTax | The amount of local tax in the currency specified in the _Amount property. The default value is 0.0.
_OtherTax | The amount of miscellaneous tax in the currency specified in the _Amount property. The default value is 0.0.

## Additional Configuration Tags

Property | Description
stagedatabase | The name of the staging database (if SQL Server is used).

## Reserved Properties

Properties reserved by the Pipeline server for future use follow:

Property | Description
_ProductID | This property is currently reserved and should not be modified.

If all required properties described previously and all product view properties defined in the product view definition file are set by previous plug-ins, the session is added to the database. If the session is a compound session, the parent session and all children are written to the database atomically in one database transaction. The rules that apply to atomic sessions are applied to each subsession of a compound.

WriteProductView writes to two database tables: t_acc_usage and the table associated with the product view of the session. The product view table is associated with a view, such as discount or recurring charge. The data in this table is displayed to the user as part of details of the usage or the session.

## Remarks

The Write Product View plug-in is also documented in the Platform Programmer’s Guide.