Skip to main content

I have a pipe-delimited text file for input

There is no header line of column names. Data starts on the first line.

How do I set column/attribute names?

I tried AttributeRenamer, but FME gives column names drawn from the first line of data. I receive a new input dataset each month, and the first line of data will change. I want to be able to assign column names based upon their order, not upon the first line of data. I need this process to be repeatable with a new input dataset.

Hi @nicholas, you can read a pipe-separated values table with the CSV reader. When you add the reader to the workspace, open its parameters dialog and modify some parameters as shown below.

  • Delimiter Character: | (pipe)
  • Field Names Line: None (or blank in older version)
  • Data Start Line: 1

The CSV reader with the configuration above generates default field names "col0", "col1", "col2", ... for each column and reads the data from the first line. You can then rename them with the AttributeRenamer if necessary.


Thank-you @takashi that did work.

But, I had a complication.

Initially, I had the parameters set to Field Names Line 1, Data Start Line 2, as this was the default.

I went back into the parameters and set them as you advised, but the field names persisted as being named after the data values of the first line.

So, I opened a brand-new blank FME workspace and created the reader, with the correct parameters. This time, FME named the columns col0, col1, etc...

So, for me, the fix was to start again in a brand-new workspace.

Thanks!


Thank-you @takashi that did work.

But, I had a complication.

Initially, I had the parameters set to Field Names Line 1, Data Start Line 2, as this was the default.

I went back into the parameters and set them as you advised, but the field names persisted as being named after the data values of the first line.

So, I opened a brand-new blank FME workspace and created the reader, with the correct parameters. This time, FME named the columns col0, col1, etc...

So, for me, the fix was to start again in a brand-new workspace.

Thanks!

Those parameters are related to the reader feature type configuration, you cannot change the feature type on the Canvas by modifying the parameters through the Navigator window.

 

As you did, replacing the existing reader with a new one with appropriate parameters would be a possible way. Alternatively, you can also update the existing feature type through the Workbench menu command "Update Feature Types".

 

  1. Check Workbench menu: Readers > Update Feature Types to start operations to update existing reader feature type(s).
  2. Click the eParameters] in the opened dialog to open the reader parameters dialog.
  3. Modify the parameters appropriately, then close the dialogs with hOK].
That's it.

Reply