Skip to main content

Hi guys,

 

I have the following attributes:

783

784

AYH

I would like to add 1 in front of any attribute starting with 7 and avoid adding to another field. What would be the best transformer to use for this? I have tried and tested the stringpadder but can't seem to get it working. Any help would be great.

StringReplacer with Replace Regular Expression: Replace ^7 with 17. That finds any values starting (^) with 7.


StringReplacer with Replace Regular Expression: Replace ^7 with 17. That finds any values starting (^) with 7.

Thank you again Dan, learning all the time. Much appreciated.


You should use a BulkAttributeRenamer for this.

Rename selected attributes

Select all attributes that start with a 7

 

Add String Prefix

 

Rename

 

String: 1

 

I see i didn't understand your question correctly. I thought you wanted to rename the attribute name not the attribute value.


You should use a BulkAttributeRenamer for this.

Rename selected attributes

Select all attributes that start with a 7

 

Add String Prefix

 

Rename

 

String: 1

 

I see i didn't understand your question correctly. I thought you wanted to rename the attribute name not the attribute value.

No issue @jkr_da Thanks for your help


Thank you again Dan, learning all the time. Much appreciated.

No problem! 🙂 Regexes are very often the solution, so make use of the Regular Expression Editor in FME in the transformers that have it, or use regex101.com or similar to test your ideas for complex regex-strings.


There's also the option to use an attributecreator with a conditional statement

If the value of attribute begins with 7 create a new value of 1 and existing attribute otherwise do nothing


Reply