Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Split a column into two

Hi Team,

I have a table containing three fields STUDENT, TYPE and MARKS.

I need to split Column TYPE in to two columns i.e.. SUBJECT and  EX_TYPE

SUBJECT column will contain PAPER-I, PAPER-II, PAPER-III and so on.

EX_TYPE column will contain INTERNAL, EXTERNAL, PRACTICAL etc.

Can any one help me out of this problem.

Regards

Priyanka

Tags (2)
1 Solution

Accepted Solutions
patroser
Not applicable

Re: Split a column into two

should like something like this in load script:

LOAD

     Student,

     Marks,

     Subfield(Type, ' ', 1) as Subject,

     Subfield(Type, ' ', 2) as Ex_Type

FROM ...

Best regards,

Patrick

4 Replies
patroser
Not applicable

Re: Split a column into two

should like something like this in load script:

LOAD

     Student,

     Marks,

     Subfield(Type, ' ', 1) as Subject,

     Subfield(Type, ' ', 2) as Ex_Type

FROM ...

Best regards,

Patrick

greeshma_k
Not applicable

Re: Split a column into two

You can use a subfield function in your script if the two columns are going to be separated by space.

subfield(Type,' ',1) as SUBJECT,

subfield(Type,' ',2) as EX_TYPE

prieper
Not applicable

Re: Split a column into two

Suggest to use SUBFIELD with three params:

SUBFIELD(Type, ' ', 1)     AS Subject,

SUBFIELD(Type, ' ', 2)     AS ExType

edit: messages crossed - sorry, apostroph removed

HTH Peter

Not applicable

Re: Split a column into two

Thanks a lot Patrick