Try OpenEdge Now
skip to main content
Managed Adapters Guide
File Managed Adapter : Working with the File Adapter : Configuring the File Adapter : Using the Delimited Text plug-in
 
Using the Delimited Text plug-in
The Delimited Text plug-in provides support for files containing a sequence of records, each one a comma-separated list of values. Although comma is the default, you may select any other string (except new line) as field separator. The record separator is always the new line character.
Note: The separator used in the Delimited Text plug-in must not be used as a part of the text.
To configure Delimited text plug-in:
1. In the File Adapter Configurator dialog box, select the Mode as Read, Write or Append, and enter the file name - preferably pointing to your temporary directory.
2. Select Data Format as Delimited. After you have selected Delimited, the generic File Format tab is enabled and renamed to a format-specific tab called Delimited.
3. Click the Delimited tab.
In this tab you can enter the name and type of each field in your record.
4. Click Add to define a new record. The Parameter Editor dialog box appears.
a. Define a Name for the field.
b. Define the Type of the value it will contain.
c. Click OK to return to the configurator box.
5. Continue adding more fields as appropriate.
6. Click Modify to modify the field definition.
Click Remove to delete a field.
Click Move Up or Move Down to move the field to match the desired record structure.
7. Click Advanced to define a field separator other than the default (","). The Advanced Parameters dialog box is displayed.
a. Select the Separator String from the drop-down list or enter your custom character/string.
For Write or Append mode, the separator is simply a string that will be inserted between the fields. The only special characters are "space" and "tab" that are presented as \s and \t in the pull-down list, so they can be distinguished visually.
In Read mode, the separator is not a simple string, but a regular expression (regex) that will be used to split the record into fields. You should be aware of this, especially if the separator you are using has a special regex meaning. For example, if you want the fields to be separated with "*", in Read mode you should define the separator regex as \*.
Using regular expressions to split the fields allows for more complex separators to be defined. For example, if the fields in your file are delimited with one or more blank (space or tab) characters, you can define the separator as \s+. For additional information on regular expressions syntax, check the API documentation for java.util.regex.Pattern, available online from Sun Microsystems.
b. The Line Number field is enabled when you set the mode to Read. In this case, if the delimited-text file you are reading has more than one record, you can specify which record you want to read. The default is to read the first record (1). You can enter any record number you want, or select Last for the last record of the file.
You can also select Mapped indicating that the record number should come from a dataslot. In the last case, the record number field will be visible when you define the mapping for the adapter, allowing you to map the value from the dataslot, containing the record number.
c. Click OK to return to the Configurator dialog box.
8. Click OK to return to the Properties view.
9. Click Change mapping to open the Dataslot Mapping dialog box. Open the Data tab.
10. For Write or Append mode, select a dataslot under Source where the fields in your record should come from. The value of this dataslot will be stored in your output file. For Read mode, select a dataslot in the Target drop-down list to which the fields in your record should store. Note that depending on the File Adapter configuration, the mapper window may look different or may contain additional fields.
11. Click OK. The File Adapter is now fully configured for delimited text files.