Skip to main content
Question

Globally update value from -99 to Blank

  • February 26, 2013
  • 5 replies
  • 25 views

Forum|alt.badge.img
Afternoon All, i have a ESRI file gdb with 20 featureclasses within it. i want to change the value -99 to Blank within all the attributes and all the tables. LIke a global value mapper. Is there any simple solution im missing ?

 

 

Thanks Steve
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

  • February 26, 2013
FME doesn't have a global value replacer. But perhaps you can use the StringReplacer. You would need one for each feature class though.

sigtill
Supporter
Forum|alt.badge.img+25
  • Supporter
  • February 26, 2013
Also you could use a PythonCaller to iterate through all the attributes and replace the values. That way you would not need to specify which attributes that needs replacing.

david_r
Celebrity
  • February 26, 2013
Hi Steve,

 

 

It would be possible to make something with an AttributeExploder and a looping custom transformer, but a PythonCaller is probably the fastest and easiest solution, as SigTill also suggests. Here is an example:

 

 

import fmeobjects   def global_string_replacer(feature):     attributes = feature.getAllAttributeNames()     for attrib in attributes:         value = feature.getAttribute(attrib)         if str(value).strip() == "-99":      # Search             feature.setAttribute(attrib, "") # Replace

 

It is easy to convert this into a custom transformer where the search and replace strings are given as parameters, if necessary.

 

 

To read all the features classes in a File Geodatabase, you could use the reader "Schema (Any Format)" and then pass the list of feature class names to a FeatureReader.

 

 

David

 

 

Forum|alt.badge.img
  • Author
  • February 26, 2013
Thanks all for your input. Davids python script is magic. Looks like i will need to delve deeper into python callers in the future. 

 

 

Thanks David and others

 

 

Cheers Steve

david_r
Celebrity
  • February 26, 2013
Good to hear it worked, Steve.

 

 

The PythonCaller is an incredibly powerful transformer once you "get" it, I can heartily recommend spending some time to understand its capabilities!

 

 

Here are some starting points: Feel free to ask here if you have questions on your path to Python mastery with FME!

 

 

David