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: 
AmCh
Creator
Creator

List from subfolders

Hello all,

I want to create from the folder FolderA with path (N:\Dashboard\FolderA) a list with the subfolders of FolderA (also FolderA1, FolderA2,FolderA3).

The desired output then:

FolderA
FolderA1
FolderA2
FolderA3

 

Any help please?

Thanks in advance

Best regards

1 Solution

Accepted Solutions
Vegar
MVP
MVP

Try this:


LET vRootPath = 'C:\Temp\FolderA\';

For each vSubFolder in DirList('$(vRootPath)*')
  LOAD
    Mid('$(vSubFolder)', 1+ len('$(vRootPath)')) as FolderA
  AutoGenerate 1;
next vSubFolder

View solution in original post

4 Replies
Vegar
MVP
MVP

You can create folders with qlikview by execute statements.

Try a script like this:

LET vRootPath = 'N:\Dashboard\FolderA\';
FOR each vSubFolder in 'FolderA1', 'FolderA2'
  Execute cmd.exe /C mkdir $(vRootPath)&$(vSubFolder);
next vSubFolder

 

PS: you might need to adjust your settings to allow the script to run write and execute statements.

AmCh
Creator
Creator
Author

Hi Vegar,

thank you for your prompt response.
I want actually to create a field from already existed FolderA.

FolderA exists with the path 'N:\Dashboard\FolderA'. Its subfolders exist as well and are FolderA1 and FolderA2.
I want just to create a field with the name FolderA and with field values FolderA1 and FolderA2.

 

Thank you in advance.

Vegar
MVP
MVP

Try this:


LET vRootPath = 'C:\Temp\FolderA\';

For each vSubFolder in DirList('$(vRootPath)*')
  LOAD
    Mid('$(vSubFolder)', 1+ len('$(vRootPath)')) as FolderA
  AutoGenerate 1;
next vSubFolder

Amit
Contributor III
Contributor III

Perfect!