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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
hkg_qlik
Creator III
Creator III

Script extract

Hi,

I have a field called department which holds multiple information. I need to extract Organization. info from the department data populated for each row.

Example:

Dep.ID       Department        

1               ABC - Helpdesk

2               XYZ - HR

3               NULL

4               IT

5               ABC - Network

Now I want to create an Organization field during my loading process to extract only ABC, XYZ values. If its null or  does not contain a - I don't want to extract info for that row.

Regards,

H

1 Solution

Accepted Solutions
sivarajs
Specialist II
Specialist II

Just to simplify use subfield(Department,'-',1) as field while loading your script     

View solution in original post

2 Replies
Not applicable

temp: LOAD * INLINE [

DepID,      Department      

1,              ABC - Helpdesk

2,              XYZ - HR

3,              NULL

4,              IT

5,              ABC - Network

];

Final:

noconcatenate

Load DepID,

If(Index(Department,'-')>0,Left(Department,Index(Department,'-')-1),'') AS Department_Final

RESIDENT temp;

Drop Table temp;

sivarajs
Specialist II
Specialist II

Just to simplify use subfield(Department,'-',1) as field while loading your script