Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
brentdga
Contributor II
Contributor II

Splitting a text string field into components

Hello,

I am embarking on a data cleaning project in one of our applications, and one of the fields I want to use in analysis for this dashboard is "Business Contact". The field in our application is open text, and we generally ask people to enter either an internal mailing list (e.g., *MailingList) or their single-sign-on ID (e.g., AB12345). Of course, not everybody follows directions so we will sometimes get just someone's name (e.g., John Smith).

 

What I would like to do is pull this text into two columns and disect the strings, so today I might have:

ItemIDContact
1AB12345
2*MailingListOne
3*MailingListTwo, BC12345
4CD12345, DE12345 or *MailingListThree
5John Smith

 

and I want to turn this into something like this:

ItemIDContactContactType
1AB12345Single-Sign-On
2*MailingListOneMailing List
3*MailingListTwoMailing List
3BC12345Single-Sign-On
4CD12345Single-Sign-On
4DE12345Single-Sign-On
4*MailingListThreeMailing List
5John SmithOther

 

I'm facing two challenges...

 

First, there is no common delimiter. There might be a comma, a semi-colon, etc. Can I simply pull out any string of characters that starts with an asterisk or contains two letters followed by five numbers?

Second, once I isolate these via substring, how can I shape logic of the third column that recognizes two letters and 5 numbers as "Single Sign On"?

 

Thanks for any help or suggestions you can provide!

0 Replies