Skip to main content

Hi all,

I am working with a huge database with 300+ layers. Many layers are the same for each province and they have the same structure in their attribute table. Many of the attributes are empty but that differs from state to state (f. ex. height might be empty in 20 provinces and in 5 there is a value). Is there a transformator that shows me which attributes are completely empty for each layer and allows me to filter them without checking each attribute for each province individually? That would be a great help.

Thank you all :)

I don't think there is anything 'off-the-shelf', but this could be one way to tackle it.

  • AttributeExposer exposing fme_feature_type
  • PythonCaller to create an attribute containing comma-separated attributes with null values (code below)
  • Aggregator with Group By set to fme_feature_type, creating a list of null values
  • ListDuplicateRemover to remove duplicates
  • ListConcatenator resulting in one feature per feature type, with an attribute listing all nulled attributes.

From there you could probably do your filtering.

import fmeobjects
 
def processFeature(feature):
    
    null_lst=/]
    
    for tmpAttrName in feature.getAllAttributeNames():
        tmpAttrVal = feature.getAttribute(tmpAttrName)
        if tmpAttrVal == '':
            null_lst.append(tmpAttrName)
            
    str = ','.join(null_lst)
    feature.setAttribute("null_list",str)
 

image


One possible way using the custom transformer NullAttributeCounter, the feature merger tests whether the count of null attributes equals the number of records in the workspace and returns the attribute name where that case is met

imagePrior to this, you may need to use a null attribute mapper to make sure empty and missing attributes are null


Reply