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: 
Not applicable

Get all possible parent folders for a given folder location

Hi,

I have a rather large table (5m+ rows)  with unique folder locations e.g. C:\Windows\Tmp\30102014

I need to create another table with a row for every possible parent folder. So for the example above I would have 3 entries

Child, Parent

C:\Windows\Tmp\30102014, C:

C:\Windows\Tmp\30102014, C:\Windows

C:\Windows\Tmp\30102014, C:\Windows\Tmp

I've tried looping through the tables, but it takes far too long.

Would there be a QlikView function for this which I am not thinking of?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You can use a LOAD with a WHILE clause:

LOAD *,

           Left(Folder,index(Folder,'\',iterno())-1) as Parent

WHILE iterno()<=SubstringCount(Folder,'\');

LOAD * INLINE [

Folder

C:\Windows\Tmp\30102014

];

View solution in original post

1 Reply
swuehl
MVP
MVP

You can use a LOAD with a WHILE clause:

LOAD *,

           Left(Folder,index(Folder,'\',iterno())-1) as Parent

WHILE iterno()<=SubstringCount(Folder,'\');

LOAD * INLINE [

Folder

C:\Windows\Tmp\30102014

];