Description

The DelimitedFileReceiver writes Domain Attribute values in a delimited format to a file.


In This Article


Receiver Parameters

The following parameters can be defined for the DelimitedFileReceiver. Items with an asterisk (*) are required. 

  • path* - Defines the location to store the newly generated delimited output file.
  • subDir - Defines the subdirectory location to store the newly generated delimited output file. 
  • fileName* - Defines the name of the output file.
  • uniqueAttribute - Defines a Domain Attribute the Receiver will use to identify a unique value that has already been inserted into the file and prevents it from being inserted twice.
  • delimiter* - Defines the character used as the column delimiter.
  • headerFilePath - Defines the path to an XML configuration file with header information.
  • headerFileName - Defines the name of the XML configuration file with header information.
  • quoteTextData - Defines the character to use when quoting text data.
  • booleanValue* - Format a Boolean object with the selected mask.
  • nullValue* - Represents a Null value.
  • includeHeader* - Defines whether to include the header in the delimited file.
  • appendToFile* - Determines whether the file will open in append mode. If true, rows will be appended to the file; otherwise, the file will be overridden.


Using Multiple Header Configuration File

The DelimitedFileReceiver has two optional parameters that allow it to read from an XML configuration file that defines one or more header rows for the delimited file output.  

When these two parameters are left empty, the DelimitedFileReceiver will automatically use each Attribute's originalName parameter to define a one-row header in the delimited file output.

  • headerFilePath - Defines the path to an XML configuration file with header information.
  • headerFileName - Defines the file name of the XML configuration file that has header information.


Receiver Attribute Property Keys

The Receiver defines two property keys that can be modified on any of its associated Domain Attributes:

  • columnName - Defines the column name as it will be output in the delimited file header.
  • include - Determines if the Attribute will be included as a column in the output.


Delimiter

This Receiver allows for three delimiter types:

  • Tab - \t
  • Pipe - |
  • Comma - ,  

The Tab delimiter is the default delimiter.


QuoteTextData

This Receiver allows for three quoteTextData types:

  • None - text
  • Single - 'text'
  • Double - "text"


File Config Tab

The File Config Tab is used to configure what event will trigger file creation and the naming configuration for generated files. Click here for more information on how to use the File Config Tab.


The example below will create a new file for every 100 records. The naming for each file will look like Output-1.txt, Output-2.txt, Output-3.txt, and so on.



Directory Config Tab

The Directory Config Tab is used to configure what event will trigger directory creation and the naming configuration for generated directories. Click here for more information on how to use the Directory Config Tab.


The example below will create a subdirectory for every 10 files. Each subdirectory's naming will look like AddressFiles1, AddressFiles2, AddressFiles3, and so on.


Example Stories

The example stories below show different use cases where the DelimitedFileReceiver is used to write Domain Attributes to a delimited file. In some cases, the parameters or property key values determine the behavior of the Receiver and how or if this data is written to the generated delimited file.

Example Domain

The example outputs are based on the User Domain below: 


Story 1 - Example Single-Row Header Without Configuration File

This example shows the configuration and sample output for a Tab-delimited file without an XML configuration file. In this example, the value of each Attribute's originalName is used to define the single-row header. 


Parameter Configuration

The configuration will appear similar to what is shown below:



Sample Output - Single-Row Header without Configuration File

The following is the sample output file using the Domain and Parameter configuration shown above:
 


Story 2 - Example Multi-Row Header with Configuration File

This example shows a Tab-delimited file example with an XML configuration file that defines a three-row header for each user domain column.


Parameter Configuration

To use an XML configuration file, you will need to enter values for these two parameters: 

  • headerFilePath
  • headerFileName



Example Configuration File

The following is an example XML configuration file that defines a three-row header for each of the User Domain columns:


<headers>
  <attribute name='id'>
    <column></column>
    <column></column>
    <column>ID</column>
  </attribute>
  <attribute name='firstName'>
    <column></column>
    <column>First</column>
    <column>Name</column>
  </attribute>
  <attribute name='lastName'>
    <column></column>
    <column>Last</column>
    <column>Name</column>
  </attribute>
  <attribute name='emailAddress'>
    <column>User </column>
    <column>Email</column>
    <column>Address</column>
  </attribute>
  <attribute name='username'>
    <column></column>
    <column></column>
    <column>username</column>
  </attribute>
  <attribute name='password'>
    <column></column>
    <column></column>
    <column>password</column>
  </attribute>
</headers>


Sample Output - Multi-Row Header With Configuration File

The following is an example output of a Tab-delimited file with the XML configuration file defined above: 


How to Remove Header in a Generated Delimited File

By default, a generated delimited file will have headers when using the DelimitedFileReceiver. These headers are the Attributes used to generate the file. 


For example, if the Attributes are IdfirstName, and lastName, then headers with the same name will be present in the generated delimited file by default. 


The includeHeader Parameter may be used to remove these headers from the generated file. When set to False, the headers will not appear in the generated output file.



If you have already downloaded the Scenario and generated your data, then you will need to download the Scenario again and run it on your local computer to view the new file with no headers. 


The following is a sample output file in comma-delimited format with no headers.


Note: If you are still seeing the headers after changing the includeHeader Parameter to False, then your Receiver Jar File may be outdated. To learn more about checking the Jar File version, please see How to Check the GenRocket Jar File Version.


Note: If you would like to include the header in the file again, set the includeHeader Parameter to True, save the change, download the Scenario, and run it again on your local computer.