Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load data out of variable locations

Hi Community,

I need to load data out of different locations. Here is what I have setup for this:

// Set the current directory

directory 'C:\Users\xyz\Desktop\';

// folders to load

set FolderScope = 'Folder1','Folder2','Folder3','Folder4','Folder5';

FOR each FilePath in $(FolderScope);

LOAD '$(FilePath)' & '\' & filename() as source,

@1, @2,  @3,  @4 as @4,  @5,  @6, @7,  @8,  @9,  @10,  @11,  @12,   @13, @14,   @15,

left(@8,4) as year,  mid(@8,5,2) as month,

@2 & @3 & @4 & @5 & @6 & @7 & @8 & @9 & @10 & @11 as unikey

  FROM [$(FilePath)\*test*] (txt, codepage is 1252, no labels, delimiter is '|', msq);

NEXT FilePath;

I would like to have the line:

set FolderScope = 'Folder1','Folder2','Folder3','Folder4','Folder5';

as a variable line. Ideally users could enter more folders in a file which would be loaded and the script is reading the folders out of that file.

Any ideas how I could accomplish this?

Thanks,

Oliver

6 Replies
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, Oliver,

you can enter the variable FolderScope in the layout by using an input box:

Greetings from Munich

Martina

Not applicable
Author

Hi Martina,

thanks for your feedback. But it should be a solution, where the additional folder entered by the user stays.

Let me explain it with an example:

Folder1 and Folder2 are setup, now you need to add another folder (where everytime I update the data I want to pull data out of that folder as well), then I add another one and so on. In the end it can be 100 to 200 different folder locations.

Therefore I was hope to have a solution like with an excel file, where I could read the locations from and combine it into the script.

Greetings from Kennesaw,

Oliver

PS: I was in February in Munich. Was great!

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, Oliver,

do I understand right, that different users enter different foldernames? Than the users can store them by click on a button. Than you can use this stored data in your script and concatenate many variables to one.

Yes, Munich is great, where is Kennesaw situated?

greetings

Martina

Not applicable
Author

Hi Martina,

yes, that is right, but they don't have to do it necessarialy out of Qlikview, they can enter that information also directly in an Excel file.

Kennesaw is north of Atlanta.

Oliver

PS: I am originally from Germany 🙂 Just moved here 8 years ago.

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, Oliver,

nice to hear that, last year I was in Florida and I had to change my airplane in Atlanta. And because lots of planes were in the air we had to turn round Atlanta for more than an hour. It looked very fine from the sky!

All the best to you and greetings from good old Germany

Martina

Not applicable
Author

Well, then you know the area 🙂

Any good ideas on my problem?

Oliver