Transact

āŒ˜K
  1. Home
  2. Transact
  3. Features and Functions
  4. Administrator Role and Fe...
  5. Batch Class Management
  6. Index Fields
  7. Format Conversion

Format Conversion

You can use format conversion to configure automatic formatting for extracted index fields. This allows you to save the time and effort of changing the format by hand. Format conversion occurs after extraction, and is saved to the batch.xml file.

Use Cases

Here are some common use cases for format conversion:

  • Assign prefixes and suffixes to document level fields
  • Swap dates to desired format
  • Swap uppercase and lowercase
  • Normalize common data elements
  • Replace words or values
  • String truncating
  • Reformat regular expressions with regex groups

Prerequisites

You will need to add the FORMAT_CONVERSION_PLUGIN to either of the following locations:

  • As the last plugin in the Extraction module
  • As the first plugin in the Export module.

Important: Only add the plugin to one of the modules. Ensure the Format Conversion Switch is set to ON. For more information on adding plugins, refer to Module/Plugin Configuration.

Configuration

Format conversion is configured at the index field level.

  1. From the Batch Class Management screen, open your batch class.
  2. Go to Document Types > [your document type] > Index Fields > [your index field] > Format Conversion.

Figure 1. Format Conversion

  1. Select one or more format options and configure the formation conversion rule.

Refer to the table below for a list of format options and their descriptions.

Format Option Description
Prefix Use this option to add any value before the extracted value.

Example format conversion:

Prefix #
Original extracted value 5040
Converted value #5040
Suffix Use this option to add any value after the extracted value.

Example format conversion:

Prefix .00
Original extracted value 5040
Converted value 5040.00
Replace Use this option to replace any character in an extracted value with another character.

  1. Select Once or All to specify whether the character should be replaced only once, or throughout the extracted document.
  2. Enter a character or regex in the Replace field. This is the value that will be replaced after extraction.

Note: The regex for an empty space is ā€˜\sā€™.

  1. Enter a character or value in the With field. This is the value that will replace the original value after extraction.

Note: You can create multiple replace rules by clicking the plus icon (+).

Example format conversion:

Replace \s
With _
Original extracted value 5040 1010
Converted value 5040_1010
Change Case Use this option to change the case of the extracted value to either lowercase or uppercase.

Important: If multiple format options have been configured, change case will execute before prefix or suffix formatting.

Example format conversion:

Change case To Upper
Original extracted value sample
Converted value SAMPLE
Sub String Use this option to specify a portion of a string of text to be extracted. You will need to specify the start index and end index of the part to be extracted.

Example format conversion:

Start 1
End 3
Original extracted value ABC-123
Converted value ABC

Note: To use a single character from the extracted value, specify the same value for the start and end index.

Change Currency Use this option to convert extracted currency to a selected currency type.

Note: You can add or remove currency codes from System Configuration > Currency Configuration.

Example format conversion:

From USD
To INR
Original extracted value 250.00
Converted value 18853.13
Fetch Named Group Use this option to assign a capturing group a name for later back-referencing.

You can define how the extracted data needs to be formatted by using the regex group name.

In the image above the value (123; 45; 6789) has been extracted using the following regex:

(\d{3}.+(\d{2}).+(\d{4})

If the named regex is configured as $1-$2-$3, where $1 is a reference to capture group 1 and anything else is considered a constant value, the final value saved in the batch.xml file is 123-45-6789.

Date Conversion Use this option to define any date format for a date index field.

Example format conversion:

Extracted dd/MM/yyyy
New MM/dd/yyyy
Original extracted value 20/03/2010
Converted value 03/20/2010

You can define the date formats you want to be displayed in the format-conversion.properties file located at [Ephesoft_Directory]\Application\WEB-INF\classes\META-INF\dcma-format-conversion\format-conversion.properties.

Make your changes to the formatconversion.date_formats= property.

For more information on standard date formats, refer to this Java tutorial.

Note: Change Currency and Date Formatting do not work with other formatting options. If one of these options are selected, all other options are disabled.

Test Format

You can test the format in the Test Extraction screen for your batch class.

  1. Open your batch class and go to Document Types.
  2. Click Upload Test Extraction File(s) or drag and drop files to the upload area.
  3. Click Test Extraction.
  4. Use one of the following configuration methods to test format conversion:
    • Set Workflow to ON and select Format Conversion as the extracted plugin.
    • Set Workflow to OFF and set Format Values to ON.

Conclusion

This completes an overview of how to use format conversion to configure automatic formatting for extracted index fields.