Hi FME’ers,

A couple of year’s ago I wrote an article about ‘conditional processing’ in FME, and when to use the different filtering and mapping transformers. Looking back it seems a bit long-winded and complicated (sorry) and so I wanted to write this short post to simplify matters.

Basically I want to describe when to use the Tester, TestFilter, and AttributeFilter. I figure I can do that using some simple examples.

EvangelistBanner7

The Tester

The Tester transformer is for simple Yes/No decisions, for example:

Testing-Tester

These tests can be combined as well, within a single Tester, for example:

They can be quite complex too, in what we call a composite test, for example:

…but each component is still a simple Yes/No test. The order of the conditions is only important when you do a composite test (and not always then).

The AttributeFilter

The AttributeFilter is best for testing many values for a single attribute, for example:

Testing-AttributeFilter

You wouldn’t do combination tests here (for example, a road can’t be both Primary and Secondary) and so the order of the tests is not important.

The TestFilter

The TestFilter is best for filtering a feature by a set of cascading conditions, for example:

To play in the FME golf tournament you must pass one of these conditions (similar to the Masters qualification rules):

Testing-TestFilter

It’s a set of cascading tests, because if you are the current FME golf champion, you qualify at the top of the list. You don’t need to be tested against any other criteria. So here the test order is important.

Like the Tester, each test can be a combination of conditions, for example:

EvangelistBanner7

If the above seems familiar, well it’s an expanded version of some info in the FME training course.

I hope you find this a useful reference,

NewBlogSignature

About FME Attributes FME Evangelist Tester

Mark Ireland

Mark, aka iMark, is the FME Evangelist (est. 2004) and has a passion for FME Training. He likes being able to help people understand and use technology in new and interesting ways. One of his other passions is football (aka. Soccer). He likes both technology and soccer so much that he wrote an article about the two together! Who would’ve thought? (Answer: iMark)

Comments

2 Responses to “Testing… testing… – a simple guide to FME filter transformers”

  1. Randy says:

    I have set up an attribute filter. All filter outputs are green. Each is connected to a feature service writer. All writer connections are green. All fields show up (green) in both filter and writer. When I select “inspect” on the writer, the output is correct.
    But when I run the workspace, the filter simply doesn’t go. No features pass through. There is no error. I get a “Translation Succeeded” message and a “Features Written: 0” message.
    How do I find out why the filter is not working?
    Thank you,
    Randy McGregor

    • Mark Ireland says:

      Hi Randy
      I think the best method is to use the “Run with Breakpoints” option. So in Workbench select Run > Run with Breakpoints from the menubar to turn it on (also be sure to turn off any other run options). Then right-click the connection into the AttributeFilter and choose Add Breakpoint. Now run the workspace. The first feature to the AttributeFilter will cause it to pause, and a window open to inspect that feature. You’ll be able to see at a glance what its attribute value is and whether it matches an option in the AttributeFilter. If it looks like it should be OK, but fails, then try using an AttributeTrimmer transformer to trim off any hidden whitespace. That can often be a cause for such issues. Failing that I suggest that you post this question on our FME community Q+A (knowledge.safe.com) and we can take a closer look at it there.
      Hope this helps
      Mark

Leave a Reply to Randy Cancel reply

Your email address will not be published. Required fields are marked *

Related Posts