Skip to main content

I'm converting a batch of shp from one MCD to another. I can easily map 80% of the fields without any problem. But for the output MCD I need to generate a new primary key based on a concatenation of a string and a three digit increment. I've tried modifying the value (in the feature type dialog box) using the text editor, and 'string_'@Count() - this sort of works it produces 'string_1' etc but i need 'string_001' etc. Also, I already use Count() in another field which seems to confuse FME - This is probably very easy, but I'm new FME...

You can add a Format function to it, like this:

string_@Format(%03d,@Count())

This will left-pad the count with zeroes to 3 characters.


You can add a Format function to it, like this:

string_@Format(%03d,@Count())

This will left-pad the count with zeroes to 3 characters.

Thanks that helped a lot!  

To summarize:

I started with  string_@Format(%03d,@Count()) - but I still had problems as I used multiple instances of Count() in the table. 

So in end I used a Counter before my file writer (to avoid using Count() multiple times. So in the end I  used this:

'string_@Format(%03d,@Value(_count))'

 


Reply