Skip to main content
Best Answer

Wanting to replace data in multiple attributes to multiple strings of text. Is there a transformer that I can use for this?

  • November 10, 2021
  • 5 replies
  • 457 views

So I have multiple columns of data that return a yes or no value. I'm really only concerned with the yes value.

 

When the value in the Cut Grass attribute is 'Yes' - i want to replace the Yes with say "cut grass to 100mm"

Then i have another Yes value in Remove Flammable materials column and I want to replace the Yes with "remove materials".

 

Is there a multiple string replacer transformer that I can use.

 

I need to do this for approx 13 different attributes. I have read about string replacer or attribute value mapper. But whilst string replacer can replace multiple attributes to the same replacement text it doesn't allow for differing replacement text individual to a column.

Best answer by geomancer

Maybe the Conditional Value option from the AttributeManager can help you out.

 

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.

5 replies

redgeographics
Celebrity
Forum|alt.badge.img+62

I think the SchemaMapper should be able to do this (but I'd struggle to tell you exactly how)


geomancer
Evangelist
Forum|alt.badge.img+60
  • Evangelist
  • Best Answer
  • November 10, 2021

Maybe the Conditional Value option from the AttributeManager can help you out.

 


ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • November 10, 2021

I'm not sure there is a straightforward FME solution

 

A python solution in this case is much simpler and easier to manage imo

import fme
import fmeobjects
 
def processFeature(feature):
    mydict = {'Cut_Grass':'cut grass to 100mm','Remove_Flammable_Materials':'remove materials'}
    attrs = feature.getAllAttributeNames()
    for a in attrs:
        if feature.getAttribute(a)=='Yes':
            feature.setAttribute(a,mydict[a])

 


  • Author
  • November 10, 2021

Maybe the Conditional Value option from the AttributeManager can help you out.

 

Hi Geomancer - yep i stumbled across this...and yes it is working perfectly. Thanks for your help

 


mark2atsafe
Safer
Forum|alt.badge.img+59
  • Safer
  • November 12, 2021

I think the SchemaMapper should be able to do this (but I'd struggle to tell you exactly how)

I had a go and it was easier than I expected! You can find it in this video - about 30 minutes in, after another SchemaMapper question.