Processing batch data to create multiple documents

The Output service can create separate documents for each record within an XML batch data source. The Output service can also create a single document that contains all records (this functionality is the default). Assume that an XML data source contains ten records and you instruct the Output service to create a separate document for each record (for example, PDF documents). As a result, the Output service generates ten PDF documents.

The following illustration also shows the Output service processing an XML data file that contains multiple records. However, assume that you instruct the Output service to create a single PDF document that contains all data records. In this situation, the Output service generates one document that contains all of the records.

The following illustration shows the Output service processing an XML data file that contains multiple records. Assume that you instruct the Output service to create a separate PDF document for each data record. In this situation, the Output service generates a separate PDF document for each data record.

The following XML data shows an example of a data file that contains three data records.

<?xml version="1.0" encoding="UTF-8"?> 
<batch> 
<LoanRecord> 
    <mortgageAmount>500000</mortgageAmount> 
    <lastName>Blue</lastName> 
    <firstName>Tony</firstName> 
    <SSN>555666777</SSN> 
    <PositionTitle>Product Manager</PositionTitle> 
    <Address>555 No Where Dr</Address> 
    <City>New York</City> 
    <StateProv>New York</StateProv> 
    <ZipCode>51256</ZipCode> 
    <Email>TBlue@NoMailServer.com</Email> 
    <PhoneNum>555-7418</PhoneNum> 
    <FaxNum>555-9981</FaxNum> 
    <Description>Buy a home</Description> 
</LoanRecord> 
<LoanRecord> 
    <mortgageAmount>300000</mortgageAmount> 
    <lastName>White</lastName> 
    <firstName>Sam</firstName> 
    <SSN>555666222</SSN> 
    <PositionTitle>Program Manager</PositionTitle> 
    <Address>557 No Where Dr</Address> 
    <City>New York</City> 
    <StateProv>New York</StateProv> 
    <ZipCode>51256</ZipCode> 
    <Email>SWhite@NoMailServer.com</Email> 
    <PhoneNum>555-7445</PhoneNum> 
    <FaxNum>555-9986</FaxNum> 
    <Description>Buy a home</Description> 
</LoanRecord> 
<LoanRecord> 
    <mortgageAmount>700000</mortgageAmount> 
    <lastName>Green</lastName> 
    <firstName>Steve</firstName> 
    <SSN>55566688</SSN> 
    <PositionTitle>Project Manager</PositionTitle> 
    <Address>445 No Where Dr</Address> 
    <City>New York</City> 
    <StateProv>New York</StateProv> 
    <ZipCode>51256</ZipCode> 
    <Email>SGreeb@NoMailServer.com</Email> 
    <PhoneNum>555-2211</PhoneNum> 
    <FaxNum>555-2221</FaxNum> 
    <Description>Buy a home</Description> 
</LoanRecord> 
</batch>
Note: Notice that the XML element that starts and ends each data record is LoanRecord.

Set PDF run-time options

Set the following run-time options for the Output service to successfully process batch data and create multiple files based on an XML data source:

Many Files:
Specifies whether the Output service creates a single document or multiple documents. You can specify true or false. To create a separate document for each data record in the XML data source, specify true.

File URI:
Specifies the location of the files that the Output service generates. For example, assume that you specify C:\\Adobe\forms\Loan.pdf. In this situation, the Output service creates a file named Loan.pdf and places the file in the C:\\Adobe\forms folder. When multiple files exist, the file names are Loan0001.pdf, Loan0002.pdf, Loan0003.pdf, and so on. The documents are placed on the server hosting LiveCycle, not the client computer.

Record Name:
Specifies the XML element name in the data source that separates the data records. For example, in the example XML data source that is shown, the XML element that separates data records is called LoanRecord. (Instead of setting the Record Name run-time option, you can set Record Level by assigning it a numeric value that indicates the element level containing data records. However, you can set only the Record Name or the Record Level; you cannot set both values. In the above XML, the record level to create multiple documents is 2.

Incremental loading

When the Output service processes batch records, it reads data that contains multiple records in an incremental manner. That is, the Output service reads the data into memory and releases the data as the batch of records is processed. The Output service loads data in an incremental manner when either one of two run-time options is set. If you set the Record Name run-time option, the Output service reads data in an incremental manner. Likewise, if you set the Record Level run-time option to 2 or greater, the Output service reads data in an incremental manner.

You can control whether the Output service performs incremental loading by using the PDFOutputOptionsSpec or the PrintedOutputOptionSpec object’s setLazyLoading option. You can specify the value false, which turns off incremental loading.

If the Output service cannot perform incremental data loading, the Output service writes the following warning message in the log file of the J2EE application server hosting LiveCycle:

*  2007-11-01 11:51:23,215 WARN  [com.adobe.document.XMLFormService] $$$/com/adobe/document/xmlform/msg.XFA=Unable to perform an incremental data load. Performing a full data load. 
Note: If the Output service does not read data in an incremental manner, the entire batch data file is read into memory. This behavior can have a detrimental effect on the performance of the Output service. (See Improving the performance of the Output service.)

// Ethnio survey code removed