Skip to main content
Question

Fanout on attribute after generic reader


ebygomm
Influencer
Forum|alt.badge.img+39

I have a workspace that reads a table and then outputs a map per polygon feature using a fanout on the writer. This relies on there being an attribute called Name with unique values within the source table.

 

 

I'm trying to make this a bit more robust and catering for situations where an attribute called Name might not exist (e.g. it's actually NAME or name)

 

 

I can use a Schema_mapper to rename NAME and name to Name but this doesn't cater for the situations where the unique field is called _name or even ID :-)

 

 

What I'd really like to be able to do is get the user to type the field name to be used to fanout when selecting the source input but I can't figure out if this is possible. Any ideas?

11 replies

david_r
Celebrity
  • January 20, 2014
Hi,

 

 

I suspect that's not possible without using more than one workspace.

 

 

David

david_r
Celebrity
  • January 20, 2014
Just an idea: have you tried using something like an AttributeRenamer to read the published parameter into an attribute? You could then "hard code" this attribute into the fanout settings.

 

 

David

ebygomm
Influencer
Forum|alt.badge.img+39
  • Author
  • Influencer
  • January 20, 2014
I know you can rename a specified attribute to a parameter value, but I want to choose the attribute to rename based on the parameter value which I can't see is possible.

 

 

I suspect the easiest solution in this instance might be to get the user to access the schema and add the relevant field name in there to be remapped.

takashi
Influencer
  • January 20, 2014
Hi,

 

 

How about creating new attribute with the AttributeCreator? Attribute Name: _fanout_attribute Value: @Value($(ATTR)) "ATTR" is name of a parameter whose value should be selected by user.

 

 

Takashi

ebygomm
Influencer
Forum|alt.badge.img+39
  • Author
  • Influencer
  • January 20, 2014
Yes, that works. I had tried that earlier but as the workspace at that time had some user_attributes associated with the reader typing in the name set the parameter to an attributevalue rather than a string which then caused the attributecreator to fail.

david_r
Celebrity
  • January 20, 2014
Hi,

 

 

Just to clarify, my original suggestion was identical to Takashi's, but I guess he made it clearer :-)

 

 

David

ebygomm
Influencer
Forum|alt.badge.img+39
  • Author
  • Influencer
  • January 20, 2014
I was getting hung up on the AttributeRenamer bit when actually I wanted an AttributeCreator. :-)

 

 

(I'm still using 2013 so it may be possible in 2014 to reference a parameter within the renamer?)

david_r
Celebrity
  • January 20, 2014
If FME 2013, you can actually use the AttributeRenamer to:
  • Rename attributes(!)
  • Create attributes
  • Remove attributes
Example:

 

 

 

 

Also, you can reference published and private parameters inside, as in the example above.

 

 

David

ebygomm
Influencer
Forum|alt.badge.img+39
  • Author
  • Influencer
  • January 20, 2014
Ah, never appreciated you could just leave the old attribute blank like that to create a new attribute. I'll give you a thumbs up too :) , although not sure that'll work as i'm having to write this from my phone as linked images on fmepedia crash my browser when I'm logged in. The joys of work computers.

takashi
Influencer
  • January 21, 2014
I've never used the AttributeRenamer for creating or removing attributes. The functionality seems to be effective in some cases.

 

Thanks for the clarification, David.

fmelizard
Safer
Forum|alt.badge.img+19
  • Safer
  • January 21, 2014
This was published by the FME Evangelist already at the start of 2012.

 

http://blog.safe.com/2012/01/fmeevangelist96/

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