Question

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

  • 1 August 2018
  • 3 replies
  • 177 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?


3 replies

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

Badge +3

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.

Badge +2

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

Reply