Solved

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

  • 24 January 2023
  • 3 replies
  • 11 views

Badge +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.

icon

Best answer by vladimirb777 25 January 2023, 17:34

View original

3 replies

Userlevel 4
Badge +30

Hi @vladimirb777​ 

 

Please, see the attached Workspace.

 

Thanks in Advance,

Danilo

Userlevel 4

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

Badge +1

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