Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

How to number SubField results?

I need to number the SubField() function results so you can identify each part individually, see the code:

Source:

Load * Inline [

Id, Text

1, ‘part a,part b,partc’

2, ‘part a,part d,part e’

];

SubFields:

Load Id,

SubField(Text,’,’) as SubText,

magicfunction() as Order

Resident

                Source;

Expected result:

Id     SubText     Order

1     part a          1

1     part b          2

1     part c          3

2     part a          1

2     part d          2

2     part e          3

Right now I'm using RecNo() generating secuential number but gives me huge numbers for the last records.

Any idea what magicfunction() can be?

Thank you!

Enrique.

1 Solution

Accepted Solutions
Employee
Employee

Re: How to number SubField results?

The magic function is IterNo(), but you need to use a While loop:

SubFields:

Load Id,

     SubField(Text,',',IterNo()) as SubText,

     IterNo() as Order

     Resident Source

               While IterNo() <= 1+Len(KeepChar(Text,','));

HIC

2 Replies
Employee
Employee

Re: How to number SubField results?

The magic function is IterNo(), but you need to use a While loop:

SubFields:

Load Id,

     SubField(Text,',',IterNo()) as SubText,

     IterNo() as Order

     Resident Source

               While IterNo() <= 1+Len(KeepChar(Text,','));

HIC

Not applicable

Re: How to number SubField results?

Hernic thank you very much, it worked like a charm!

Community Browser