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

How to add blank inbetween cell values

Gsiva3
8 - Asteroid

Hi Team,

 

I have a content in the cell  like AABCABCHDAKIJHUHYGTRLKJHTBAGRTLKJHYLFGHTPQWERPTHFM this. Now what I want has a output is, I want to add " " a blank space into this cell at the series of five characters. So after every 5th character I want to add the blank space.

The output should like AABCA BCHDA KIJHU HYGTR LKJHT BAGRT LKJHY LFGHT PQWER PTHFM

 

Can anyone please help on this to solve.

 

 

8 REPLIES 8
atcodedog05
22 - Nova
22 - Nova

Hi @Gsiva3 

 

Here is how you can do it.

 

workflow:

atcodedog05_0-1622014274184.png

1. Using record id i am creating row id. This will be the key reference just in case you have multiple rows.

2. Using Regex tool tokenize mode i splitting 5 letters to each row.

3. Using Summarize with record id (key) on groupby i am conacting the rows with separator " " space to get the desired output. Just for reference i am creating input field by concating the rows with no separator.

 

Hope this helps 🙂

 

Qiu
21 - Polaris
21 - Polaris

@Gsiva3 
We can trust RegEx. 😁

0526-Gsiva3.PNG0526-Gsiva3-1.PNG

atcodedog05
22 - Nova
22 - Nova

Hi @Gsiva3 

 

I got some time to try out regex approach. And here is it is approach 2 using regex_replace()

atcodedog05_0-1622016184872.png

 

 

REGEX_Replace([Input], "(\w{5})(\w{5})", "$1 $2")

 

I am finding subsequent 5 letters using marked groups and then adding space inbetween "$1 $2"

 

Definitely approach 2 is recommended

 

Hope this helps 🙂

 

atcodedog05
22 - Nova
22 - Nova

Manh posted nearly at the same time @Qiu with few seconds difference 😅 Close call

Gsiva3
8 - Asteroid

Hi @atcodedog05  & @Qiu 

 

Got it! Thank you so ,much.

 

I just want to know one more thing. If I want to add "*" instead of Blank space, then how this can be done?

atcodedog05
22 - Nova
22 - Nova

Hi @Gsiva3 

 

 

REGEX_Replace([Input], "(\w{5})(\w{5})", "$1*$2")

 

 

Just replace " " with "*" in between $1 & $2.

 

atcodedog05_0-1622022747586.png

 

Hope this helps 🙂

Gsiva3
8 - Asteroid

@atcodedog05  Thank you so much!!!

Qiu
21 - Polaris
21 - Polaris

@Gsiva3 
It looks like @atcodedog05 already provided your follow-up question and thank you for the accept mark.

Labels
Top Solution Authors