Skip to main content
Question

How can I add an increment at each change in an attribute value.

  • February 5, 2016
  • 3 replies
  • 271 views

lferg
Contributor
Forum|alt.badge.img
  • Contributor

I have a list of observations where the assetID may appear a number of times, so I have added an "Increment" attribute that I want to populate with 01,02,03,04 which will recurr with each change in assetid. I can do this in excel, by using the if statement looking at the row above. =IF(A2=A1,B1+1,1) how can I do this in FME?

My data looks like this - and want to add the suffix which I have added manually here as an example

Inspectionsuffix to addWW201601201784601WW201601201784602WW201601201784603WW201601201784604WW20001206523401WW20001206523402WW20001206523403WW20001206523404WW20001206523405WW20001206523406

3 replies

roland.martin
Forum|alt.badge.img+9

See above - you need to use a Counter, with the Counter Name set to your attribute. Then pad the string, and concatenate it, and Bob's your uncle.


takashi
Influencer
  • February 5, 2016

Alternatively the StringFormatter can also be used instead of the StringPadder.

  • Attributes: _count
  • Format String: 02d

lferg
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • February 8, 2016

Thanks guys. Perfect, and so easy when you know how!


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