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'


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), "$","")

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

3 replies

danilo_fme
Evangelist
Forum|alt.badge.img+41
  • Evangelist
  • January 25, 2023

Hi @vladimirb777​ 

 

Please, see the attached Workspace.

 

Thanks in Advance,

Danilo


david_r
Evangelist
  • 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
  • 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), "$","")


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