Skip to main content
Solved

Set attribute to defined if source contains string

  • June 27, 2013
  • 3 replies
  • 17 views

Forum|alt.badge.img
So I have an attribute (TYPE)  that has several different values like WEST RAMP and GENERAL PARKING. I need a way to search that field and find values that contain "PARKING" or "RAMP" and map them appropriately. I was hoping to find a batch way of doing it since I have about 15 different destination values and would rather not have 15 StringSearchers. I thought about using a TestFilter but 15 output ports with AttributeSetter's isn't too clean.

 

 

Any thoughts? PythonCaller maybe?

Best answer by takashi

Hi Sean,

 

 

If you are using FME 2013 SP1 or later version, consider using conditional mapping functionality of the AttributeCreator. See "FME 2013-SP1: Conditional Processing in FME".

 

Using that functionality, you can replace 1 TestFileter (having 15 output ports) and 15 AttributeCreators with only one AttributeCreator.

 

 

Takashi
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

takashi
Celebrity
  • Best Answer
  • June 27, 2013
Hi Sean,

 

 

If you are using FME 2013 SP1 or later version, consider using conditional mapping functionality of the AttributeCreator. See "FME 2013-SP1: Conditional Processing in FME".

 

Using that functionality, you can replace 1 TestFileter (having 15 output ports) and 15 AttributeCreators with only one AttributeCreator.

 

 

Takashi

ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • June 28, 2013
You could use a string searcher to find the parts with a regular expression such as

 

 

(parking|ramp)

 

 

Then an attributevaluemapper on the matchedcharacters to set a new attribute (you may need a stringcasechanger inbetween depending on the data) 

Forum|alt.badge.img
  • Author
  • June 28, 2013
Thanks for the feedback! Takashi's approach seems to be working out perfect! That is a nice bit of functionality that is in there.

 

 

-Sean