Skip to main content
Solved

How do I use Arithmetic editor in AttributeManager to change a field that has '$1,300,000' to be an integer '1300000'

  • January 24, 2023
  • 3 replies
  • 108 views

Forum|alt.badge.img+1

I have tried all the ways I could think of to do this but cannot find anything on how to change a text field to an integer field like in ArcGIS Pro. Please help! This is what I have tried:

@int(USER_Price)

@int(@replace(@replace(USER_Price, "$", ""), ",", ""))

 

I have also tried @Trim which produced a 3 digit result.

Best answer by vladimirb777

After looking over more FME tutorials I realized I was using the wrong tool in Attribute Manager and that the appropriate tool to use is the Text Editor. I ended up figuring it out, but thank you to the other respondents for answering my question! The code that yielded the result I wanted was as follows:

@Trim(@ReplaceString(@Value(USER_Price),",","",caseSensitive=TRUE), "$","")

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

danilo_fme
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • 2077 replies
  • January 25, 2023

Hi @vladimirb777​ 

 

Please, see the attached Workspace.

 

Thanks in Advance,

Danilo


david_r
Celebrity
  • 8391 replies
  • January 25, 2023

You could use the \W (note upper case) regex to match all non-numbers and replace with an empty string. This can be implemented with the StringReplacer or as an expression in e.g. the AttributeManager:

@ReplaceRegularExpression("@Value(USER_Price)","\W","",caseSensitive=FALSE)

 Documentation: https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/!Transformer_Parameters/StringFunctions.htm


Forum|alt.badge.img+1
  • Author
  • 2 replies
  • Best Answer
  • January 25, 2023

After looking over more FME tutorials I realized I was using the wrong tool in Attribute Manager and that the appropriate tool to use is the Text Editor. I ended up figuring it out, but thank you to the other respondents for answering my question! The code that yielded the result I wanted was as follows:

@Trim(@ReplaceString(@Value(USER_Price),",","",caseSensitive=TRUE), "$","")