Skip to main content
Solved

Adding Number in front of a existing Attribute

  • November 14, 2019
  • 6 replies
  • 118 views

Forum|alt.badge.img

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.

Best answer by danullen

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

View original
Did this help you find an answer to your question?

6 replies

Forum|alt.badge.img
  • Best Answer
  • November 14, 2019

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


Forum|alt.badge.img
  • Author
  • November 14, 2019
danullen wrote:

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.


jkr_wrk
Influencer
Forum|alt.badge.img+28
  • November 14, 2019

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.


Forum|alt.badge.img
  • Author
  • November 14, 2019
jkr_da wrote:

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


Forum|alt.badge.img
  • November 14, 2019
fazsnatch wrote:

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.


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • November 14, 2019

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


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