Question

Create Identifier based on attribute value

  • 30 April 2015
  • 2 replies
  • 17 views

Badge
Dear FME community,

 

 

I have an attribute which contains several unique string combinations. For example:

 

attribute: number

 

values: "one", "two", "three", "four", "five"

 

 

I want to add a unique number (id) as a new attribute. Each attribute with the value "one" should become 1, each value "two" should become 2 and so on. If there are more than a single "one", then each one should have the new value 1.

 

 

I tried to solve this with the counter transformer with "Counter Name" set to the attribute "number", so that this attribute is the attribute to group by. But this one didn't work. It only works with the CRCCalculator, but then I don't get the simple id's that I want.

 

 

Any idea's on how to solve this issue? I simply want create a new column wich contains a number as a new identifier for the string attribute value.

 

 

Kind regards from Germany

 

Thomas

 

 

2 replies

Userlevel 2
Badge +17
Hi Thomas, the AttributeValueMapper or the StringPairReplacer might help you.

 

Takashi
Badge +3
yes or use  [string map "one" 1 "two" 2 etc. ] in a attributecreator

Reply