Skip to main content

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?
Hi,

 

 

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

 

 

David
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
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.
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
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.
Hi,

 

 

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

 

 

David
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?)
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
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.
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.
This was published by the FME Evangelist already at the start of 2012.

 

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

Reply