Skip to main content
Question

Count if event occurred consecutively

  • April 15, 2024
  • 1 reply
  • 55 views

alejacd
Contributor
Forum|alt.badge.img+1

Hello,

I have some data which shows if an event occured per month. 

Events 202301 202302 202303 202304 202305 202306
a 1 1 0 0 1 1
b 1 1 1 1 0 0
c 0 0 0 1 1 1
d 1 0 1 0 1

0

 

I want to count the events which occurred 3 or more times consecutively. So I want to get this

Events More than 3 consecutive events? count 
b yes 4
c yes 3

 

Not sure how I should do this in FME. Can someone help me?

Thank you!

1 reply

geomancer
Evangelist
Forum|alt.badge.img+48
  • Evangelist
  • April 15, 2024

Use a StringConcatenator to get all attributes in one attribute

Use a StringSearcher to find features that have at least 3 consecutive 1's (regular expression 1{3,})

Use an AttributeManager to get the number of consecutive 1's 

Note: this gets the first occurence of 3 or more consecutive 1's. There may be more.

 


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