Skip to main content
Solved

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

  • December 30, 2021
  • 7 replies
  • 54 views

runneals
Supporter
Forum|alt.badge.img+27

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

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

JennaKAtSafe
Safer
Forum|alt.badge.img+8
  • Safer
  • 192 replies
  • January 4, 2022

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
Supporter
Forum|alt.badge.img+27
  • Author
  • Supporter
  • 321 replies
  • January 4, 2022

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
Celebrity
  • 7843 replies
  • January 5, 2022

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


runneals
Supporter
Forum|alt.badge.img+27
  • Author
  • Supporter
  • 321 replies
  • January 5, 2022

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+37
  • Contributor
  • 2002 replies
  • 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+8
  • Safer
  • 192 replies
  • Best Answer
  • January 5, 2022

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
Supporter
Forum|alt.badge.img+27
  • Author
  • Supporter
  • 321 replies
  • January 5, 2022

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​ !