Liquid Studio Documentation
Data Mapping / Data Mapper Functions / By Category / Text / Text File Target
In This Topic
    Text File Target
    In This Topic

    Function Name
    Text File Data Target
    Category
    Text
    Icon
    Description
    Writes data from to a delimitated or fixed width format file (CSV etc).
    Inputs
    Filename Source file to read data from, if this input is not connected then the filename provided in the 'Default Source File' property
    Row A row is create for each line read form the source file
    Child Items Row contain a number of child items that reflect the fields defined when the component is created.
    Outputs
    Data The raw Text data (does not need to be connected)
    Properties
    Default Source File The default data file to read from. This is used if the input connection point 'Filename' is not connected.
    Store Relative Indicates if paths should be stored relative to the transform, or as absolute paths.
    Execution Order If the transform contains multiple Output Components then this determines the order in which they are executed
    Default Target Uri The filename the Text document will be written to (Ignored if the Filename input is connected or the Data output is connected).

     

    Creating an Text File Target

    When the Text Writer component is dragged onto a transform a setup wizard is launched to guide you through the creation of the data target.

    If you already have an example of an output file then you can use this to define the structure that will be used for your writer.

    The "Read structure from existing sample document" runs another wizard that allows you to define the structure of your document based on an existing file format.

    Delimiter Type

    There are 2 forms of file delimited and fixed width, delimited files use a special character to separate fields, fixed width pad all the fields so they take up the same amount of space.

    Some files also contain the column names on the first row.

    Select the options that are applicable and press Next.

    Delimited File Configuration

    If your file was delimitated, then the next screen allows you to define the rules used to read each field.

    The delimiters break the fields, it's possible to select a number of delimiters, but in practice the file normally only uses a tab or a comma.

    The "Fields are enclosed in quotes" property means that if the first char within a field is a quote then the value is considered to be everything up to the next quote. This makes it possible for a field to contain the delimiter character. If the field also needs to contain a quote char then 2 quote chars in a row are interpreted as a single quote.

    Data Field 1 Value Field 3 Value Field 3 Value Field 4 Value
    abc,123,xyz abc 123 xyz
    abc,"123",xyz abc 123 xyz
    abc,"1,23",xyz abc 1,23 xyz
    abc,1,23,xyz abc 1 2 xyz
    abc,"1""23",xyz abc 1"23 xyz
    abc,"1"23",xyz ERROR
    abc,1"23,xyz abc 1"23 xyz
    abc,"1""2,3",xyz abc 1"2,3 xyz

     

    Column Details Page

    If your source data contained column headings then you may well be finished at this stage, however if the data contains no column information, or you don't like the names in the file then you can change them on this page.

    Simply select the column to edit and set the name (if you are working on a fixed width file then you also get the option to set the column width).

    If you did not provide a source document to infer the structure from then you must define it here by hand.

     

    The default filename that will be used to write out the new text file. If this is not specified then the input connection point 'Filename' must be connected.

    This provides a simple way to write to a single file, if you need to create multiple files or construct the filename dynamically, then leave this blank.

     

    Once you press Finish the new Text Data target is added to the transform and can be used as any other data target is.

    Property Pages

     

    Name

    The name of the component, must be unique within the transform

     

     

    Edit Columns

    Allows the column definitions to be manually edited.

    Default output filename

    If the writer component does not have a connector to the 'Filename' input then the filename the data is written to is taken from this property.

    If the connection point 'Filename' is connected, then this property is ignored (and can be blank)

    Store as relative path

    Indicates that the filename is to be resolved relative to the data mapping file (.dm). If the transform is compiled the filename will be resolved relative to the compiled exe.

    Default Encoding

    The encoding used to write the text data to a file.

    Write column heading on first line

    If checked then all the column headings are written onto the first line of the file.

     

     

     

    Inputs

    The component has a root input called 'Filename', each value provided to this is treated as a filename and a new Text document is created.

    If the 'Filename' input (and the 'Data' Output) is not connected then the "Default Target Uri" is used (see properties window).

    The child inputs are all specific to the Text standard you selected when the component was created.

    Outputs

    The Data output returns the resulting Text document as a string. This allows it to be consumed by other components rather than just being written to a file.

    If the Data output is connected the Default Target Uri property is ignored.

    It is an error to have connections to BOTH the Data output and the Filename input.

    See Also