Skip to main content
Solved

Take action based on feature count


mattwilkie
Supporter
Forum|alt.badge.img+11

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 

 

Best answer by mattwilkie

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

View original
Did this help you find an answer to your question?

2 replies

andreaatsafe
Safer
Forum|alt.badge.img+12

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


mattwilkie
Supporter
Forum|alt.badge.img+11
  • Author
  • Supporter
  • Best Answer
  • March 2, 2022

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings