Skip to main content
Question

Globally update value from -99 to Blank

  • 26 February 2013
  • 5 replies
  • 7 views

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
FME doesn't have a global value replacer. But perhaps you can use the StringReplacer. You would need one for each feature class though.
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.
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

 

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

Reply