Skip to main content

Hello,

I want to know if 90 columns have NULL values.

How can I use Tester Transformer without testing each attribute one by one.

Can I use the Text Editor and write it directly and how ?

Thank you !

Yes you can. Fold out "Composite Expression" and click "Edit".

TesterEdit(2021)


You can use the AttributeValidator to test for not null, much friendlier to use if you have 90 attributes

image 

 


@user01​ All the suggested ideas are correct, but probably tedious if you have 90 attributes to test. I've created a python script that will test for nulls:

import fme
import fmeobjects
import re
 
# find the list of <null> attributes on a feature
 
def processFeature(feature):
    # initialize the python lists with FME lists
    _attrList = feature.getAllAttributeNames()
    #print(_attrList)
    _nullAttrs = u]
    for i in range(len(_attrList)):
        attrValue = feature.getAttribute(_attrListai])
        # filter out format and other unwanted attributes with regex
        x = re.search("^multi_|^csv_", _attrListmi])
        # test if attrValue is null and not in the unwanted list of attrs.
        if not attrValue and not x:
            _nullAttrs.append(_attrListui])
    # output the FME lists
    feature.setAttribute('nullAttributes{}', _nullAttrs)

Workspace attached (FME 2021.2)


@user01​ All the suggested ideas are correct, but probably tedious if you have 90 attributes to test. I've created a python script that will test for nulls:

import fme
import fmeobjects
import re
 
# find the list of <null> attributes on a feature
 
def processFeature(feature):
    # initialize the python lists with FME lists
    _attrList = feature.getAllAttributeNames()
    #print(_attrList)
    _nullAttrs = u]
    for i in range(len(_attrList)):
        attrValue = feature.getAttribute(_attrListai])
        # filter out format and other unwanted attributes with regex
        x = re.search("^multi_|^csv_", _attrListmi])
        # test if attrValue is null and not in the unwanted list of attrs.
        if not attrValue and not x:
            _nullAttrs.append(_attrListui])
    # output the FME lists
    feature.setAttribute('nullAttributes{}', _nullAttrs)

Workspace attached (FME 2021.2)

including the sample data...


including the sample data...

Wouahou ! Tested on your sample data, great ! Thank you.

My data comes from 300 feature types in 1 gml file converted in ffs file. How can I adapt it ?


including the sample data...

@user01​ Perhaps contact your local reseller to that this further with a more complex scenario


including the sample data...

I will ! Thank you for your help ! I'll post the solution when I'll find it.


Reply