Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

REPLACING DASH CHARACTERS

dunkindonut7777
8 - Asteroid

Hi I have a sample data here. I want to replace the "-" characters into 0 as this pertains to numeric columns but it was string when being imported. However, there is also a "-" at the start of the digits of some cells. I just want to replace the cells that have "-"  characters entirely.

 

CODEBALANCE1BALANCE2BALANCE3BALANCE4
39374937-7700521.98120000
54656898-789-90000
54656898--890652.4680000
54543649-2890.6760000-9000
54645648-600--68000
54646477-9008090--

 

Expected Output:

 

CODEBALANCE1BALANCE2BALANCE3BALANCE4
3937493707700521.98120000
546568980789090000
546568980-890652.4680000
54543649-2890.676000009000
5464564806000-68000
54646477-900809000

 

Can you help me with this one?

1 REPLY 1
DataNath
17 - Castor
17 - Castor

Hey @dunkindonut7777, you can use the Multi-Field Formula to handle several fields at once. If you're only looking to replace instances where the whole value is '-' then I'd go with this expression:

 

IF ToString([_CurrentField_]) = '-' THEN 0 ELSE [_CurrentField_] ENDIF

 

The benefit of this tool is you can also change the output's data type without creating a new field, so can cast your incoming strings to numeric values when doing the replacement (see the 'Change Output Type to' configuration:

 

woo.png

Labels