Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

replacing text in a string

Hi all, i have a field with values such as..

Admin

Admin, IT

Audit, IT

Audit, IT, Marketing

Sales, Marketing, Admin

etc

i want to separate the string into its own value, i.e.

Admin

IT

Audit

Marketing

Sales

then store these new values into a field.

i have used the following..

if(Wildmatch(MY_FIELD,'*Sales*')>0,'Sales',

  if(wildmatch(MY_FIELD,'IT^')>0,'IT')) as Dept;

this works for all of the values apart from 'IT' as IT is also present in 'Audit'.

does anyone know of a way i can separate IT and not include Audit?

13 Replies
sunny_talwar

Script:

Table:

LOAD *,

  SubField(MY_FIELD, ', ') as MY_FIELD_NEW;

LOAD * Inline [

MY_FIELD

Admin

Admin, IT

Audit, IT

Audit, IT, Marketing

Sales, Marketing, Admin

] (delimiter is '|');

Output:

Capture.PNG

Chanty4u
MVP
MVP

Load
SubField(NewString,'#',1) as MainCategory,
SubField(NewString,'#',2) as NewCategory;
Load SubField(String,',') as NewString;
Load * Inline [
String
"

Admin

Admin, IT

Audit, IT

Audit, IT, Marketing

Sales, Marketing, Admin

"
]

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

thats great, the LIKE function worked.

thanks very much

Chanty4u
MVP
MVP

yes ur ri8 sunny...