Skip to main content
Question

Globally update value from -99 to Blank

  • February 26, 2013
  • 5 replies
  • 9 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

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+24
  • 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

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings