Skip to main content

I'm trying to build a workspace that will allow users to select a file, identify X and Y attribute names using published parameters and have it be translated AND transformed. I found the Easy Translator demo, which covers the translated part of what I'm trying to do (and is broken - I submitted an issue on GitHub). Now I'm getting stuck on the transformation part as the attribute names are read in as a feature, and the actual attribute names are coming through as col0 ... col5, etc.

I need to get to a point where I can either identify what column number that the attribute names are that they listed in the published parameters, or ideally rename the col0 attribute to the actual name that it is.

Hi @runneals. I believe the easiest way would be to use an AttributeCreator to create a new column and assign values with it from your published parameters. Hopefully I've understood the problem correctly, feel free to upload your workspace for more clarity!


Hi @runneals. I believe the easiest way would be to use an AttributeCreator to create a new column and assign values with it from your published parameters. Hopefully I've understood the problem correctly, feel free to upload your workspace for more clarity!

That would work, except that when I try to read in a csv using a generic reader, it uses col0 col1 col... for the attribute names, preventing users from easily identifying the columns/attributes they want.


Hi @runneals​ , how are the actual attribute names given when you run the workspace?


Hi @runneals​ , how are the actual attribute names given when you run the workspace?

@Takashi Iijima​ I was hoping to make it user friendly input (so if it was AttributeNameX, they would enter AttributeNameX). Right now I think the generic reader is using col0 ... col5 and the first line is being read in as a feature, so if we can figure out how to make the first line be used as column names, that should work.


The Generic Reader is often problematic. I've found that using a creator->filenamePartExtrator (extension) ->Tester/TestFilter ->FeatureReaders allows me to have finer control of the formats that don't play nicely with the GenericReader. So you could have a FeatureReader set to CSVs as well as one set to generic.


That would work, except that when I try to read in a csv using a generic reader, it uses col0 col1 col... for the attribute names, preventing users from easily identifying the columns/attributes they want.

Hi @runneals​, it looks like the behavior you described matches a bug with the Generic Reader in FME that we are currently tracking. Currently the workaround for this is to use the option to add Readers as Resources in Workbench. For example if you are reading in a CSV you could add a CSV reader as a resource and that will be enough to get around the issue.


That would work, except that when I try to read in a csv using a generic reader, it uses col0 col1 col... for the attribute names, preventing users from easily identifying the columns/attributes they want.

Worked like a charm! I assume this is needed for all file types that we want to read in, correct? Can I be added onto the bug? Thanks @jennaatsafe​ !


Reply