Solved

Take action based on feature count


Badge +8

I'm sure this is really basic but I'm stumped. How do I take some sort of action based on the number of features emitted by a previous transformer?

 

In this particular instance I need to abort the final write (and send an email) if the number of features are less than 2000. I have a Counter, and can see the number of features. I have a Tester, but it appears to be testing each feature instead of the total count.

 

Counter and Testertester equation: _count > 2000 

 

icon

Best answer by mattwilkie 2 March 2022, 23:08

View original

2 replies

Badge +10

Hi @mattw1ilkie​ ,

There are a few ways I can think of to do this: a FeatureCounter or a StatisticsCalculator (select an attribute and just get the total count).

Then you can use a Tester to test the attribute that is created that will hold the total number of features coming through.

(Then a Terminator transformer for the Failed port of the Tester - if you are looking to end the workspace if anything comes out of the Failed port)

Hope this helps!

Andrea

Badge +8

In my scenario Aggregator turned out to be the better transformer to use. When I used FeatureCounter an email was sent for every single record in the incoming stream!

 

image

Reply