Templates and the Pipeline Dictionary
When a controller or a pipeline is processed, the Pipeline Dictionary accepts and stores parameters in key-value pairs. A template can show only the dynamic information that is stored in the Pipeline Dictionary at the time the template is called.
The value of a key-value pair stored in the Pipeline Dictionary can be:
- Simple values, stored as strings
Some key-value pairs are delivered in their simplest form, for example, ProductID = 4569. You could parse the value of the ProductID key and use an <isprint> statement in the template to show the product number directly in the storefront, as shown:
<isprint value = "${pdict.ProductID}">
- Complex objects, containing more attributes and values
Many keys have as their value a complex object that acts as a container for many other key-value pairs. However, templates can't show complex objects; they only show simple values, such as strings or numbers. To obtain the values of complex objects' properties, a special notation is used describing the path through the object to the simple property that the template can show.
The following
<isprint>
statement shows how to show the value of the FirstName variable on the DataSheet form of the Buyer object:
<isprint value = "${pdict.Buyer.dataSheet.firstName}">
Pipeline Dictionary and Controllers
Controllers do not manipulate the Pipeline Dictionary directly; instead, they construct an object that is passed to a template. This object consists of name-value pairs.
You can use the UX Studio debugger to view the
contents of the object before it is passed into a template. Within the
template context, the variable pdict
is used to reference
this object.
Pipeline Dictionary and Pipelets
Information on available key-value pairs in the Pipeline Dictionary can be found in the Properties editor of the pipelet that produces the appropriate key as an output parameter and puts it in the Pipeline Dictionary.
If the value of a key-value pair is a complex object, you need to know the name of its attributes that contain the values you want to appear in a template.
- To determine the key-value pair's key attributes
- Open UX Studio.
- Select the pipelet.
- Look in the Properties editor.
- Observe the Dictionary Input and Output
keys, which are the key-value pairs.
For example, for AddGiftCertificateToBasket (bc_api) it would be:
Dictionary | Key | Value |
---|---|---|
Input | Amount | CurrrentForms.giftcert.purchase.βamount.value |
Basket | Basket | |
Message | CurrrentForms.giftcert.purchase.βmessage.value | |
ProductListItem | ProductListItem | |
RecipientEmail | CurrrentForms.giftcert.purchase.βemail.βvalue | |
RecipientName | CurrrentForms.giftcert.purchase.βrecipient.βvalue | |
SenderName | CurrrentForms.giftcert.purchase.βfrom.βvalue | |
Shipment | Shipment | |
Output | AddGCErrorMessage | null |
GiftCertificateLineItem | GiftCertificateLineItem |
The available key-value pairs of the selected attribute appear.