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

Alteryx Designer Desktop Discussions

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

ReplaceChar() vs Replace()

BretCarr
10 - Fireball

So here is my rant/debate between the functions ReplaceChar() vs Replace() in Alteryx. Here is the setup data:

 

Carr","Bret","D","Carr","Spouse","

 

 

I want to replace:

 

","

 

 

With a single underscore:

 

_

 

 

See image below. What I received with ReplaceChar() was three underscores! I'm sure there is a use case for this but I'd love to hear anyone's use case if you have one!

 

Here is the difference for using the two. I don't see the point of the ReplaceChar () if Replace() can do nearly the exact same thing.

ReplaceChar_vs_Replace.png

 

Rant over. 😂

8 REPLIES 8
MarqueeCrew
20 - Arcturus
20 - Arcturus

Rant accepted (sorry @Rant , this isn't about you!)

 

 replacechar will replace any characters listed it the specified replacement. If you have "," being replaced, it treats each char independently. 

replace looks for the string in its entirety. It replaces "," nicely with a single underscore. 

Cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
BretCarr
10 - Fireball

Even though I knew this as the answer, I will mark you as the solution as you are 100% correct. 😅

 

I just don't like having two things that basically do the same thing in different ways and having to figure which is the better choice. Sometimes there are just too many options. haha

MarqueeCrew
20 - Arcturus
20 - Arcturus

@BretCarr ,

 

A challenge for you:

 

 without using a unique tool, provide me with 3 ways to find what would otherwise come out of the unique anchor of a unique tool. 

cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
BretCarr
10 - Fireball

What kind of homework kind of thing is this?!

 

  1. Add recordIDs for identification of dupes, run remove duplicates.
  2. You could run a dynamic input to alter the XML REGEX expression parse value to actual row value, looking for a match under that row (i.e. from 1 down, 2 down, 3, down, etc.) to the end. Any match is a means a duplicate.
  3. Run REGEXMATCH formula on column.

Not very thorough, but that's where my mind takes me.

MarqueeCrew
20 - Arcturus
20 - Arcturus

@BretCarr ,

 

I've placed a workflow here that has 3 alternative methods (besides CReW macros) to get you to the unique tool output.  Care to add to this workflow?  I open the gauntlet to others lurking in the post too.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Zhengyi
8 - Asteroid

Thanks for sharing!

Tam
9 - Comet

@MarqueeCrew Alternative 1 😲

My contribution alternative 4 (only if the field 1 is numeric) .

Tam
9 - Comet

@MarqueeCrew In addition to alternative 4. I wanted to be able to identify unique in a data set without a numeric column + I wanted to add a challenge to do it without using the preparation palette.  

Labels
Top Solution Authors