Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #35: Data Cleansing Practice

Nicole_L
8 - Asteroid

Tricky formulas but learned a new one today.

beccat
8 - Asteroid

Great practice and prep.

p-g
8 - Asteroid

I have tried multiple solutions for each of the problems.

 

Spoiler
I have used Formula Tool to arrive at the solution. I have also alternatively used Regex - Replace, Regex - Tokenize and Regex - Parse to arrive at the solution. This was a fun learning experience and introduction to various Regex options available.

Sashikumar
8 - Asteroid

Easy

Spoiler
ch35.PNG
vikb03
8 - Asteroid

Here's my solution!

 

Spoiler
Solution

vikb03_0-1603449085236.png

 

A2H
11 - Bolide
Spoiler
Capture d’écran, le 2020-10-23 à 11.10.49.png
moray
6 - Meteoroid

Hey Tony,

 

I'm relatively new to Alteryx and am working my way through these. I wonder if you might help me on an alternative solution.

 

I missed your super-simple: "SC"+[Safety Code], probably because I over-thought it.

 

I had originally tried, unsuccessfully, to use PadLeft, using variants of:

IF Length([Safety Code]) == 6
THEN PadLeft([Safety Code], 1, 'C')
ELSE [Safety Code]
ENDIF

 

Then repeated for "S"

 

Any idea why using PadLeft didn't work?

 

Cheers,

 

MB

 

 

greggrimmer1
8 - Asteroid
Spoiler
greggrimmer_0-1603665191533.png

 

p-g
8 - Asteroid

My updated solution with additional different methods of solving the challenge.

 

Spoiler
I have now used various Regex Tool Modes (Replace, Parse, Tokenize) as well as Formulas (RegexReplace and ToNumber) to arrive at the solution. Great workout for the brain.


p-g
8 - Asteroid

Hi MB,

 

Pad Left and Pad Right functions are used for adding fillers rather than prefix strings. For example, if you have 1234, 123 and 12 under Field1 where field length has been specified to be 4 characters long. You can use PadLeft([Field1], 4, "0"). This would result in the output 1234, 0123 and 0012. Similarly PadRight would result in 1234, 1230, 1200. Hope this helps! Once you get comfortable with Regex Tools and RegexReplace Function, you can use it prefix any string too. I have just posted my solutions using multiple modes of Regex and different Formula Tools. Hope this helps!