Skip to main content
Solved

Working with fields and published parameters in Dynamic Workspaces...

  • December 30, 2021
  • 7 replies
  • 25 views

runneals
Contributor
Forum|alt.badge.img+20

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.

Best answer by JennaKAtSafe

runneals wrote:

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.

View original
Did this help you find an answer to your question?

7 replies

JennaKAtSafe
Safer
Forum|alt.badge.img+6

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!


runneals
Contributor
Forum|alt.badge.img+20
  • Author
  • Contributor
  • January 4, 2022
JennaAtSafe wrote:

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.


takashi
Influencer
  • January 5, 2022

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


runneals
Contributor
Forum|alt.badge.img+20
  • Author
  • Contributor
  • January 5, 2022
takashi wrote:

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.


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • January 5, 2022

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.


JennaKAtSafe
Safer
Forum|alt.badge.img+6
  • Safer
  • Best Answer
  • January 5, 2022
runneals wrote:

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.


runneals
Contributor
Forum|alt.badge.img+20
  • Author
  • Contributor
  • January 5, 2022
runneals wrote:

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings