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.
SOLVED

Replace function

jeffv
8 - Asteroid

Hi there,

 

Just wondering if someone can provide some insight to the replace function...

 

Replace function I understand is

Replace (<field that needs replacement>, <string to be replaced>, <what new value is>).

 

It appears that <what new value is> must be a string.  Can it be a string field?

 

Example:

f1: ...abc...

f2: xyx

 

replace([f1], "abc", [f2]) doesn't seem to work.  I seem to be missing something.   Any ideas?

 

Thanks,

Jeff

 

 

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @jeffv 

 

I dont know whats the issue. Every field in replace function should be a string all parameters can be passed as fields. And your example works for me.

 

atcodedog05_0-1621270395234.png

 

Hope this helps 🙂

Sonali_Gaidhane
5 - Atom

Hi,

 

Yes thats correct. You can replace your existing string with new string only. 

 

Replace(String, Target, Replacement)

 

example - Replace("abcdefb", "b", "_")

 

Output - "a_cdef_"

jeffv
8 - Asteroid

Thanks.... looks like I made a dumb mistake....  thanks for your insight.

ebostwick
8 - Asteroid

Great workout with REGEX.  Leaned on other's a good bit to work through some of the number conversions.

Spoiler
challenge_188_solution_EDB.jpg

Labels