Skip to main content

Hi,

I am wanting to create a count that increases if a condition has been met. So as an example, if TIME is greater than 100 then the COUNT increases, otherwise it stays the same:

 

TIME - COUNT

20 - 1

70 - 1

130 - 2

220 - 3

40 - 3

80 - 3

370 - 4

 

Been stuck trying to figure this out for a while. With Python this would be easier with the use of variables but I am struggling with FME on this one.

 

I see the Count transformer has 'Group By' capability but I don't think that helps me for this situation.

If you want to do this in the excel way, look at previous rows etc, you can do this using the AttributeCreator, Advanced: Attribute Value Handling, Enable Adjacent Feature Attributes. Then use conditional values.


If you want to do this in the excel way, look at previous rows etc, you can do this using the AttributeCreator, Advanced: Attribute Value Handling, Enable Adjacent Feature Attributes. Then use conditional values.

So I had already done this with the Attribute Manager but the part I am struggling with is the conditional statement.

 

I was using the Count() function to count whenever the condition is met and that works fine for when the count increases but is there a way to display the count without adding another count. If that makes sense?

 

image


So I had already done this with the Attribute Manager but the part I am struggling with is the conditional statement.

 

I was using the Count() function to count whenever the condition is met and that works fine for when the count increases but is there a way to display the count without adding another count. If that makes sense?

 

image

How I do this:

  • AttributeCreator to create attribute _count with no value.
  • Second AttributeCreator with one prior feature.
    • If previous value has no value, then _count = 1
    • Else if value > 100, _count = previous _count + 1
    • Else _count = previous _count

Not sure if this is the official way, but it works.

 


So I had already done this with the Attribute Manager but the part I am struggling with is the conditional statement.

 

I was using the Count() function to count whenever the condition is met and that works fine for when the count increases but is there a way to display the count without adding another count. If that makes sense?

 

image

Oh this is interesting. I was stuck on how to use the existing attribute in my Conditional Visibility but did not realise that you just need to create the value in a AttributeCreator and then reuse it in the second one. Man makes calculating this so much easier. Works perfectly.

Appreciate it.


So I had already done this with the Attribute Manager but the part I am struggling with is the conditional statement.

 

I was using the Count() function to count whenever the condition is met and that works fine for when the count increases but is there a way to display the count without adding another count. If that makes sense?

 

image

Cheers :)


Reply