Skip to main content

I have 3 counters in my workspace. And I want them to produce a single count. The documentation says : "When multiple Counters have the same name and Count Scope is Global, they produce a single count."

 

In my workspace the Scope of the Counter is set to Global but, I cannot figure it out how to write the same name for the three counters!

When trying to write the same name for the counter transformers, FME (2021.1) automatically changes the names to Counter_2, Counter_3, Counter_X .... so I'm not getting a unique count for my workspace, what I have is three different counts starting from 0.

 

This is a basic question, Is the name of the transformer what I have to change to get a unique count? I'm sure I'm missing something and maybe someone can help me with this.

 

Thanks!

You found the "Name" of the counter here:

Counter Parameters > Advanced > Count Domain


You found the "Name" of the counter here:

Counter Parameters > Advanced > Count Domain

Thanks for your response!

My Count Domain for the three counters is the same default "counter"Count Domain


In 2021.2 and 2022.0 the counter works in my Test, Result is 0, 1, 2:

Test Count


In 2021.2 and 2022.0 the counter works in my Test, Result is 0, 1, 2:

Test Count

Ok, I have done the same test, my Result is 1,0,0... 😕

imagen


I was able to reproduce your result.

Basically, the counters are counting correctly, but they only count within each run of the workspace.

So in your screenshot, the cache on Counter_2 is from an earlier run of the workspace than the caches on Counter_4 and Counter_5. Renaming two of the counters and only partially running the workspace causes only those two counters to be used.

You have the right parameters. Either rerun the entire workspace, or turn off feature caching.


I was able to reproduce your result.

Basically, the counters are counting correctly, but they only count within each run of the workspace.

So in your screenshot, the cache on Counter_2 is from an earlier run of the workspace than the caches on Counter_4 and Counter_5. Renaming two of the counters and only partially running the workspace causes only those two counters to be used.

You have the right parameters. Either rerun the entire workspace, or turn off feature caching.

Thanks for responding!

I tried it but didn't work for me 😞 ... but your answer led me to think that maybe the counters are restarting the count after a FeatureWriter??, as my workspace actually is something like this:

imagen


Counter_2 and Counter_3 override Counter. I don't understand your intention to do this.


Counter_2 and Counter_3 override Counter. I don't understand your intention to do this.

Yeah, this is a simplification of the actual workflow, but what I wanted to get is like a serial number for each one.

For instance, having 10 features I want to numer them like this:

 

imagenimagen


I think you need 2 counter like this.

  • Counter_2 count normaly
  • Counter_3 + Counter_4 start with _count.max + 1

The result is unsort: Counter_4 = 3, 5, 7 Counter_3 = 4, 6, 8

Test Count2


Thanks for responding!

I tried it but didn't work for me 😞 ... but your answer led me to think that maybe the counters are restarting the count after a FeatureWriter??, as my workspace actually is something like this:

imagen

I think this is potentially an issue with version 3 of the Counter? If i use version 2 of the Counters it works as expected, if then upgrade the counters in the workflow to version 3, in 2021.2 I do not get the expected result. One for safe i think?


I think you need 2 counter like this.

  • Counter_2 count normaly
  • Counter_3 + Counter_4 start with _count.max + 1

The result is unsort: Counter_4 = 3, 5, 7 Counter_3 = 4, 6, 8

Test Count2

I've tried this and is working! For now the order is not important so I'll use this alternative, but I'm still not fully understanding the way Counters are working together on the same workspace. 😅

Thanks!


In Version 4 of the counter transfomer ( FME Version 2022.1) this error still exists.

Maybe safe can fix this please.

Thanks.


Reply