Skip to main content
Question

How to create new attributes in a feature from the value of another attribute

  • August 1, 2018
  • 3 replies
  • 1072 views

Hi,

I have an Excel reader in my workspace that have 2 attributes (CurrentName and NewName). The value of "CurrentName" shows a list of attribute names in the another reader that already are exist in my work space and the value of "NewName" shows a list of attribute names that must be create in the workspace.

I want to create new attributes that their name comes from "NewName" value and the value of new attributes comes from the another attribute that the name of it is similar to "CurrentName" value , for example:

I have this Excel file:

and add this file to my FME workspace as a dataset (reader1). In my Workspace I have another reader (reader2) that has "id" and "technology" attributes. So I want to create "NAME" and "MODEL" attributes in reader2 with the exact value of "id" attribute for the value of "NAME" attribute and the value of "technology" attribute for the value of "MODEL" attribute.

How can I do that in FME? Is there any transformer to do that?

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.

3 replies

aurelienchaumet

Hi,

if I understood what you want to do, I think SchemaMapper is the best way to do this !

 

You can see here how it works for your case ;)

 

https://knowledge.safe.com/articles/1162/attribute-mapping-schemamapper.html


lars_de_vries
Forum|alt.badge.img+10

You could also use an AttributeManager. You van creatie a new attribute using the statement @Value(NewName) and give the balie from CurrentName.

FME won't automatically recognize the new attribute, do you'll have to expose them. You can do this in the same transformer, by typing the values and set the value @CurrentAttribute(). The other optioneel is to use an AttributeExposer to expose the new attributes. Within the AttributeExposer you'll also have to set the attributes to be exposeert.


mygis
Supporter
Forum|alt.badge.img+14
  • Supporter
  • 307 replies
  • August 2, 2018

If you are looking for something Dynamic for a complex name change then the ShemaMapper is your transformer:

 

Mapping Schema using SchemaMapper

This transformer converts the existing schema of features to a new structure, based on mappings defined in an external lookup table. Using a table to define these mappings simplifies the completion of these tasks