Formatting

Grouping

After the records have been matched, according to the mapping rules, they can be grouped for the output file. By default, there is no grouping, but grouping the output data by any field is possible. Each field that requires grouping should be specified. In this example, emp_name and emp_val6 are used for grouping:

<payroll_export plugin="com.workbrain.app.export.payroll.basic.BasicPayrollExportPlugin">
  <data>
    <field name='emp_name' group='true'/>
    <field name='emp_lastname'/>
    <field name='dept_id'/>
    <field name='dept_name'/>
    <field name='emp_firstname'/>
    <field name='emp_val6' group='true'/>
    <field name='wrks_auth_date'/>
  </data>

The XML definition contains a format block for formatting the data in the output file. There are two types of formatting: field-level and file-level.

The standard Payroll Export lets you group in these ways:

  • employee, date
  • employee, date, earn code
  • employee, date, job

Field-level formatting

These options are the various field-level formatting capabilities within the XML definition:

  • Left or right field can be padded (LPAD/RPAD).
  • Source data fields can be altered for output.
  • Dates can be added with various formats.
  • Numbers can be added with various formats.
  • Spaces can be added.
  • Tabs can be added.
  • Constants can be added.
  • Characters (including "$" and "-") can be added.

File-level formatting

These options are the various file-level formatting capabilities within the XML definition:

  • Header and footer records within the output can be added.
  • Mathematical computations can be performed on records (such as sum and count).
  • Fixed length columns can be formatted.
  • The delimiter character can be modified.

This code block is an example of a format block:

<format>
  <header>
    <constant>Payroll Export</constant>
    <new_line/>
  </header>
  <body>
    <constant> : </constant>
    <datetime field='wrks_auth_date' format='yyyy-MM-dd' />
    <string field='emp_name' pad_right='20' />
    <constant> , </constant>
    <string field='emp_firstname' pad_right='20' />
    <string field='emp_lastname' pad_right='20'/>
    <constant> , </constant>
    <number field='dept_id' format='00000000.00' />
    <constant> ? </constant>
    <string field='dept_name' pad_right='20' />
    <new_line/>
  </body>
  <footer>
    <constant pad_center='80'>End of Payroll Export</constant>
  </footer>
</format>