Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
vittorianad
Contributor III
Contributor III

Load Data using GetfolderPath() function

Hi guys,

I'm trying to load data from files stored  into a server shared directory, whose path is clearly differentent from user to user.

I'm actualy using this:

DIRECTORY ;

for each File in filelist('*.xlsx')

LOAD *

FROM

[$(File)]

(ooxml, embedded labels, header is 1 lines, table is Contatti); 

next File;

it works... ok

The problem is that one of my collegue has to change the directory to it's own path

DIRECTORY ;

to make it works.


Is there any set of instructions to set the path dinamicaly?

I tried with

load

   Getfolderpath('DashBoard') as dropBox

   AutoGenerate 1;

DIRECTORY [$(dropBox)\Contatti\Piani];


but doesnt'work...

any suggestion?

thanks to all

1 Solution

Accepted Solutions
vittorianad
Contributor III
Contributor III
Author

I tried with this, but I didn't sorted out.

I got the solution mean time..

I used this

myUser:

load

    'C:\Users'&Mid(OSUser(),Index(OSUser(),'\'))&'.'&left(OSUser(),Index(OSUser(),'\')) as User

    AutoGenerate 1;

let vUser = peek('User',0);

drop table myUser;

DIRECTORY [$(vUser)Dropbox\Contatti\Piani];

it works, but now the myUser table is not really dropped and the load statement after defined loads data into this table

View solution in original post

11 Replies
ali_hijazi
Partner
Partner

my_table:

load

   Getfolderpath('DashBoard') as dropBox

   AutoGenerate 1;


let vDropBox = peek('dropBox',0);

drop table my_table;


DIRECTORY [$(vDropBox )\Contatti\Piani];

....

I can walk on water when it freezes
vittorianad
Contributor III
Contributor III
Author

HI Ali,

it return me

\\server\user\v.dambruoso\Documents

instead of

C:\Users\v.dambruoso.MANGINI\Dashboard

why?

what can I do?

ali_hijazi
Partner
Partner

may you please show me what you wrote in your script?

I can walk on water when it freezes
vittorianad
Contributor III
Contributor III
Author

hi,

myTable:

load

    Getfolderpath('Dropbox') as dropBox

    AutoGenerate 1;

let vDropBox = peek('dropBox',0);

drop table myTable;

DIRECTORY [$(vDropBox)\Contatti\Piani];

I think the problem is on the Dropbox folder, with is on my local user profile.

QlikView search in \\server\user\v.dambruoso\Documents .... !!


Is there a function to get the system users to buid the path, or is there a way to choose from a list of path and reload the data after?


Thank you

ali_hijazi
Partner
Partner

you got the same folder structure on your local machine and on the server

if yes then you can use relative paths

relative to the QVW file in which you have the script

suppose your folder structure is as follows:

Application (main folder)

DropBox (sub-folder) ->Contatti->Piani (2 sub folders)

QVW (subFolder)

suppose your file (qvw) is inside a sub-folder under QVW folder called myApp

then you can access the xml file as ..\..\DropBox\Contatti\Pianni\your_xml_file

hope this helps

I can walk on water when it freezes
vittorianad
Contributor III
Contributor III
Author

I tried with this, but I didn't sorted out.

I got the solution mean time..

I used this

myUser:

load

    'C:\Users'&Mid(OSUser(),Index(OSUser(),'\'))&'.'&left(OSUser(),Index(OSUser(),'\')) as User

    AutoGenerate 1;

let vUser = peek('User',0);

drop table myUser;

DIRECTORY [$(vUser)Dropbox\Contatti\Piani];

it works, but now the myUser table is not really dropped and the load statement after defined loads data into this table

View solution in original post

ali_hijazi
Partner
Partner

can you show me in some way the folder structure of your application

may I can figure out

I can walk on water when it freezes
marcus_sommer
MVP & Luminary
MVP & Luminary

To get the user you could try it with: osuser() or getregistrystring().

- Marcus

vittorianad
Contributor III
Contributor III
Author

Cattura.PNG

"Cruscotto_Piani_Commerciale" is the dashboard I'm working on.

"Piani" is the folder I use to store xlsx files.

and both are on Dropbox folder