Admin
February 4th, 2009, 02:07 PM
This sample job demonstrates the ability in the FusionPro VDP products to link to multiple additional external data files, perform a lookup in those files, and return results in the composition process.
To demonstrate this capability, the sample job is of a very simple statement that contains multiple items for each recipient.
The main input data file contains a customer name and a CustomerID field. There are 3 records in the input data file so 3 statements will be created. Here's the data in the main input data file:
Name CustomerID
Willis 123
Linda 456
Gerry 789A secondary data file also exists. This data file has the fields CID (the customer ID), Product Purchased, and Price for that product. For each customer, there can be multiple products in this secondary data file and all must be returned in a single statement for the customer. Here's the data in the secondary data file:
CID Product-Purchased Price
123 LCD TV $1495.00
123 Surround Speakers $279.00
123 Tax $141.92
456 Home Media Server $2,499.00
456 Universal Remote $50.00
456 Media Zone Network Adapter $79.99
456 Wireless Keyboard/Mouse Combo $109.00
456 Tax $219.04
789 Goo-B-Gone $9.95
789 Tax $0.77Using the FusionPro JavaScript function "ExternalDataFileEx()", this sample job does the following:
Link to the secondary data file with the purchase information in it (this is done in an OnJobStart rule)
For each record in the main input data file, find all items purchased by that customer by cross referencing the "CustomerID" field in the main input data file with the "CID" field in the secondary input data file.
Apply basic formatting to the display of the items purchased.
If the purchase item is "Tax", format it differently from the rest of the line items.
This sample has additional comments within the JavaScript code that explains the logic in greater detail.
To demonstrate this capability, the sample job is of a very simple statement that contains multiple items for each recipient.
The main input data file contains a customer name and a CustomerID field. There are 3 records in the input data file so 3 statements will be created. Here's the data in the main input data file:
Name CustomerID
Willis 123
Linda 456
Gerry 789A secondary data file also exists. This data file has the fields CID (the customer ID), Product Purchased, and Price for that product. For each customer, there can be multiple products in this secondary data file and all must be returned in a single statement for the customer. Here's the data in the secondary data file:
CID Product-Purchased Price
123 LCD TV $1495.00
123 Surround Speakers $279.00
123 Tax $141.92
456 Home Media Server $2,499.00
456 Universal Remote $50.00
456 Media Zone Network Adapter $79.99
456 Wireless Keyboard/Mouse Combo $109.00
456 Tax $219.04
789 Goo-B-Gone $9.95
789 Tax $0.77Using the FusionPro JavaScript function "ExternalDataFileEx()", this sample job does the following:
Link to the secondary data file with the purchase information in it (this is done in an OnJobStart rule)
For each record in the main input data file, find all items purchased by that customer by cross referencing the "CustomerID" field in the main input data file with the "CID" field in the secondary input data file.
Apply basic formatting to the display of the items purchased.
If the purchase item is "Tax", format it differently from the rest of the line items.
This sample has additional comments within the JavaScript code that explains the logic in greater detail.