Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Henric_Cronström

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

View solution in original post

2 Replies
Henric_Cronström

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

View solution in original post

Not applicable
Author

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