User Community Service Desk Downloads
If you can't find the product or version you're looking for, visit support.ataccama.com/downloads

Read File Variables

Reads workflow variables from a source file. You can specify which properties should be read from the source file along with a specific data type and format parameters (see File variable strategy). There are three implementations available:

  • Read property file: Source file contains properties defined as key-value pairs (syntax <code>property.key=property.value</code>) with one property per line. If a line is not correctly structured, the property is skipped. Using whitespaces in values is allowed at any position in the string, for example, '<code>key= value</code>' or '<code>key=va lue</code>'.

    For more information about how source files are parsed, see the Java documentation about the Properties class.

    If the source file contains duplicated keys, the task fails.

  • Read lines: Each variable is read from a line of the source file. The line itself is fully used as variable’s value, including all whitespace characters except line-ending characters.

  • Read whole file: Whole file is read and stored into a variable. Any lines beyond the limit are discarded, that is, not part of the variable value. Note that the value can also contain line-ending characters (<code>'\r'</code> or <code>'\n'</code>).

Once the data is loaded, you can reuse the values across the workflow using the following syntax: ${ewfGetTaskVariable("task_name", "key")}.

For more information about working with workflow variables, see Workflow Variables.

When using the Text File Writer step in your plan, it is necessary to change the default writer configuration and remove the string qualifier and string qualifier escape character as this causes problems when using the Read File Variables task.

Remove qualifiers

Properties

No expression support is available.
Name Type Description

Source File

mandatory

Source file that the task should read. The default extension is ewfv.

Encoding

mandatory

Encoding used in the source file. The possible encodings are all encodings supported by the target Java platform. Some commonly used encodings are: ISO-8859-1, ISO-8859-2, and UTF-8.

Max Lines

optional

Maximum number of lines that the task reads from the source file. Default value: 1000.

In case the limit set in maxLines is exceeded or a property value cannot be converted to one of the input data types, a warning is issued.

File variable strategy

Name Type Description

Implementation

mandatory

Type of file variable strategy. Read property file, Read lines, or Read whole file.

Variables

Read property file

Example configuration
Read property file
Name Type Description

Name

mandatory

Name of the variable.

Type

mandatory

Defines how to read the variable value. Currently supported types are: STRING, INTEGER, LONG, FLOAT, DAY, DATETIME, BOOLEAN.

Data format parameters

optional

Default data format parameters for the correct formatting of data in the source file. For more information, see Data format parameters.

Read lines

Example configuration
Read lines
Name Type Description

Line

mandatory

Line number from source file.

Name

mandatory

Name of the line.

Type

mandatory

Defines how to read the variable value. Currently supported types are: STRING, INTEGER, LONG, FLOAT, DAY, DATETIME, BOOLEAN.

Data format parameters

optional

Default data format parameters for the correct formatting of data in the source file. For more information, see Data format parameters.

Read whole file

Example configuration
Read whole file
Name Type Description Variable

Data format parameters

Name Type Description

Array separator

optional

Defines which character is used as the array separator.

Date format local

optional

Defines the locale for parsing non-numerical data (for example, short forms of months in dates, such as Sep 18, 1999). The value is the same as the value of the corresponding locale in Java (see Java locales).

Datetime format

optional

Defines the format that should be used for processing datetime data. The template is based on SimpleDateFormat, which uses the Java convention.

Day format

optional

Defines the format that should be used for processing day data. The template is based on SimpleDateFormat, which uses the Java convention.

Decimal separator

optional

Defines which character is used as the decimal separator. Escaped string property.

False value

optional

String value representing a logical false value in the given data. The comparison is not case sensitive.

Thousand separator

optional

Defines the string that represents the thousands separator (used in numbers). A non-escaped character is expected.

Numbers do not need to contain this separator, but when the separator is present, it is processed (stripped) accordingly. Escaped string property.

Default value: ,.

True value

optional

String value representing a logical true value in the given data. The comparison is not case sensitive.

Example

<?xml version='1.0' encoding='UTF-8'?>
<EwfTaskElement>
    <acceptMode>ALL_VALID</acceptMode>
    <executable maxLines="1000" encoding="UTF-8" class="com.ataccama.adt.task.exec.EwfReadFileVariablesTask" sourceFile="variables.ewfv">
        <fileVariableStrategy class="com.ataccama.adt.variables.read.ReadPropertyFile">
            <variables>
                <variableMapping name="variable1" type="STRING">
                    <dataFormatParameters falseValue="false" dateTimeFormat="yy-MM-dd HH:mm:ss" decimalSeparator="." dayFormat="yy-MM-dd" trueValue="true" dateFormatLocale="en_US" thousandsSeparator=""/>
                </variableMapping>
                <variableMapping name="variable2" type="STRING">
                    <dataFormatParameters falseValue="false" dateTimeFormat="yy-MM-dd HH:mm:ss" decimalSeparator="." dayFormat="yy-MM-dd" trueValue="true" dateFormatLocale="en_US" thousandsSeparator=""/>
                </variableMapping>
            </variables>
        </fileVariableStrategy>
    </executable>
    <id>read_variable</id>
    <priority>0</priority>
</EwfTaskElement>

Was this page useful?