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

String Parsing

Krish
8 - Asteroid

Hi All,

 

I have string parsing requirement as follows.

"Kannan ABCD Building" -> Source Text

I need to parse first 10 chars as Name.
remaining as Address.
Like

Kannan ABC as Name
But remaining as Address however like this
ABCD Building

That is I have to see if the 11 th charcter is part of particular word,If so I have to parse that too as Address

Could you please advice on how to achive this.

Currently I have following:

To Parse Name:

Left([SourceText],10)

To Parse Address:

IF Length([SourceText]) > 10 THEN

Substring([SourceText],10,Length([CompanyName])-1)

 

Thanks,

Krish

4 REPLIES 4
MarqueeCrew
20 - Arcturus
20 - Arcturus

@Krish,

 

In line with how you were attempting this.....

 

If the first word is more than 11 bytes, then get that first word as Name, otherwise take the leftmost characters up to the last space as Name.

 

Name =

IF Length(GetWord([String], 0)) >= 10
	THEN Getword([String],0)
ELSE
	Trim(Left([String],10-FindString(ReverseString(left([String],10)),' ')))
ENDIF

Address =

Trim(Replace([String],[Name],''))

Seems to work for me....

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

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

Thanks a lot.The reverse string usuage helped to identify proper start index location.

I re arranged for my requirement.It worked.

 

Thanks!

Krish
8 - Asteroid

Thanks a lot.The reverse string usage helped to identify proper start index location.

I re arranged for my requirement.It worked.

 

Thanks!

Krish
8 - Asteroid

Thanks.It worked!

 

Labels
Top Solution Authors