Question

Count if event occurred consecutively

  • 15 April 2024
  • 1 reply
  • 43 views

Badge +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

Userlevel 5
Badge +36

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.

 

Reply