Question

Add value to attribute

  • 19 March 2013
  • 5 replies
  • 69 views

Badge
Hi All,

 

Here is simple question;

 

 

How do you assign a value to an existing attribute after the feature passes thru a tester? 

 

 

If the test is true then I want to add a value of "YES" to an existing attribute before it proceeds thru other transformers.  I want to use an existing attribute and not have to create a new attribute and then overwrite the existing attribute.

 

 


5 replies

Badge +2
You need to use an AttributeCreator transformer and link it to the PASSED output port. In the AttributeCreator choose your existing attribute on the left column (AttributeName)and set the value to YES in the right column (Value). There used to be an AttributeSetter in earlier versions but this has been combined into the AttributeCreator from at least FME 2012 onwards.
Userlevel 4
Hi,

 

 

you could also take a look at the StringConcatenator if you want to add "YES" to the end of the existing attribute value. 

 

 

David
Badge +10
Hi - after your Tester, just add an AttributeSetter (in FME 2012 onwards this will default to an AttributeCreator). Then pick the attribute you wish to over write from the drop down list and set the "Value" to YES. All features that pass your test will have the value of this attribute set to YES. It's nice and simple...

 

 

Hope that helps.
Userlevel 4
Badge +25

In FME2013-SP1 (which will be available in 16 hours and 50 minutes) you can do it all in the AttributeCreator. There is a new option for conditional attribute mapping/creating.

 

 

Keep an eye out for an evangelist article I am going to publish tomorrow on the topic. It'll be at: http://evangelism.safe.com/fmeevangelist113/

 

 

Regards

 

 

Mark
Badge
Thanks everyone!  All very helpful comments.

Reply