BuildFileFromProperties

A step based on this step template creates an output file that contains the values of RICOH ProcessDirector job and document properties for a job. The file can be in any format, including XML, JSON, and CSV.

To create the output file, the step first writes the value of the File header property to the output file. Then the step writes the value of the File body property to the file, once for each document in the document properties file. If there is a value for the Delimiter property, it is inserted after each occurrence of the File body text, except the last one. Finally, the step writes the value of the File footer property to the file.

You can use RICOH ProcessDirector symbol notation in all of those property values. The symbols are placeholders for the job and document values that you want to include in the file when the step creates it.

You can use symbols for job properties—but not document properties—in the values for the File header and File footer properties.

You can use symbols for both job and document properties in the value for the File body property. In the output file, job values are the same for each document.

The step uses the document properties file in the spool directory for the job as input. The file name is in the format jobid.document.dpf where jobid is the job number. For example: 10000009.document.dpf. The first line in the file contains the database name of each document property. Each additional line contains values for each of the properties from one document.

Example

These examples show how the step creates an XML, a CSV, or a JSON output file for three documents in a job named Bank Statements 02032017 with 14 pages.

The example creates XML elements that contain the values of two job properties:

  • Job name ( Job.Name)
  • Total pages ( Job.TotalPages)

The database names of the properties are in parentheses.

The example creates elements that contain the values of four document properties:

  • Document number ( Doc.ID)
  • Current pages ( Doc.CurrentPages)
  • Customer name ( Doc.Custom.CustomerName)
  • Customer account number ( Doc.Custom.AccountNumber)

Value of File header property:

XML

<?xml version="1.0" encoding="utf-8"?>
<InputFile>
  <PDF>${Job.Name}</PDF>
  <TotalPages>${Job.TotalPages}</TotalPages>

JSON

{
  "JobName": "{Job.Name}",
  "TotalPages": {Job.TotalPages},
  "Documents": [

CSV

JobName,TotalPages,DocNumber,PageCount,Custname,CustAccount

Value of File body property:

XML

<Document>
  <DocNumber>{Doc.ID}</DocNumber>
  <PageCount>{Doc.CurrentPages}</PageCount>
  <Customer Custname="{Doc.Custom.CustomerName}" CustAccount="{Doc.Custom.AccountNumber}" />
</Document>

JSON

{
    "DocNumber": {Doc.ID},
    "PageCount": {Doc.CurrentPages},
    "Custname": "{Doc.Custom.CustomerName}",
    "CustAccount": "{Doc.Custom.AccountNumber}"
  }

CSV

{Job.Name},{Job.TotalPages},{Doc.ID},{Doc.CurrentPages},{Doc.Custom.CustomerName},{Doc.Custom.AccountNumber}

Value of Delimiter property:

JSON

,

    Note:
  • When generating an XML or CSV file, you can leave the Delimiter property empty.

Value of File footer property:

XML

</InputFile>

JSON

  ]
}

    Note:
  • When generating a CSV file, you can leave the File footer property empty.

Document properties file in the spool directory for the job:

Doc.ID,Doc.CurrentPages,Doc.Custom.CustomerName,Doc.Custom.AccountNumber
1,4,Jane Smith,SA349088
2,4,Chris Lopez,SA347202
3,6,John Gray,SA340655

XML output file:

<?xml version="1.0" encoding="utf-8"?>
<InputFile>
  <PDF>Bank Statements 02032017</PDF>
  <TotalPages>14</TotalPages>
  <Document>
    <DocNumber>1</DocNumber>
    <PageCount>4</PageCount>
    <Customer Custname="Jane Smith" CustAccount="SA349088" />
  </Document>
  <Document>
    <DocNumber>2</DocNumber>
    <PageCount>4</PageCount>
    <Customer Custname="Chris Lopez" CustAccount="SA347202" />
  </Document>
  <Document>
    <DocNumber>3</DocNumber>
    <PageCount>6</PageCount>
    <Customer Custname="John Gray" CustAccount="SA340655" />
  </Document>
</InputFile>

JSON output file (with the Delimiter property)

{
  "JobName": "Bank Statements 02032017",
  "TotalPages": 14,
  "Documents": [
    {
      "DocNumber": 1,
      "PageCount": 4,
      "Custname": "Jane Smith",
      "CustAccount": "SA349088"
    },
    {
      "DocNumber": 2,
      "PageCount": 4,
      "Custname": "Chris Lopez",
      "CustAccount": "SA347202"
    },
    {
      "DocNumber": 3,
      "PageCount": 6,
      "Custname": "John Gray",
      "CustAccount": "SA340655"
    }
  ]
}

CSV output file

JobName,TotalPages,DocNumber,PageCount,Custname,CustAccount
Bank Statements 02032017,14,1,4,Jane Smith,SA349088
Bank Statements 02032017,14,2,4,Chris Lopez,SA347202
Bank Statements 02032017,14,3,6,John Gray,SA340655

Job property defaults
  • File header:

  • File body:

  • Delimiter:

  • File footer:

  • Output file:

Usage notes:

  • To create an output file that contains the values of job properties but not document properties, leave the value of the File body property blank.
  • The step writes the value of the File body property to the output file only when both these conditions apply:
    • The File body property specifies a value, typically referencing one or more valid document properties.
    • The spool directory for the job contains a document properties file.
  • You can use one or more characters in the Delimiter property to separate each occurrence of the body text.

  • If you created XML or JSON output, you can validate it by using a step based on the CheckFileStructure step template.
  • If no values are supplied for the File header, File body, and File footer properties, the step creates an empty file.