Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
New Contributor II

Split line in script

Hello everyone, how to write a script to turn T1 into T2. thanks.

t1:  

monlyvalues
201701AA
201702BB,CC

t2:

   

monlyvalues
201701AA
201702BB
201702CC
Tags (1)
5 Replies
Highlighted
Partner
Partner

Re: Split line in script

Try

load

monly,

subfield(values,',') as values

resident t1;

Highlighted
New Contributor II

Re: Split line in script

good, thank you! 

Highlighted
Contributor II

Re: Split line in script

Hi guiqiang,

For splitting the values in Qlik we have 'Subfield' function.


Subfield format:

Subfield (text, delimiter, field_no)

or

Subfield (FieldName, delimiter, field_no),

Now Let's talk about your table.

Subfield(Values,',',1) as Values

It is better to define field_no in the third parameter.

I have also attached example app. Hopefully, this will solve your problem.

Highlighted
New Contributor II

Re: Split line in script

I see, thank you very much.

Highlighted
Contributor II

Re: Split line in script

Please mark as correct if you reach your solution.

Thanks.