Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Autoloading a file


I apologise if this has been answered multiple times, however I am still trying to get to grips with the behind the scenes of Qlikview.

Problem:

I have a file that is generated into a directory. The directory gets cleaned everytime there is a new file created so that there is only one file in there at any one given time. However the file names changes every time it is created. I need to load this file into qlikview without having to change the code every time. The file format and fields does not change. So an example of files can be:

\\temp\allocation\zzzalldata-2013-12-24.xlsx or

\\temp\allocation\zzzalldata-2014-01-01.xlsx etc.....

Question:

Is there a way in Qlikview to load a file from a specified directory without knowing the file name. So I know the directory is \\temp\allocation\. I know that the last part contains a date and I want to extract that from the file name as well, so I know when the file was created. I would hope someone would help me code this.

Current code example:

Directory;

Load a,

        b,

        c

FROM

[temp\allocation\zzzalldata-2013-12-25.xlsx]

(ooxml,embedded lables, table is [report$]);

Thank you very much for your assistance

1 Solution

Accepted Solutions
mr_janne
New Contributor III

Re: Autoloading a file

Hi,

if the folder really has only a one file then you can use the wildcard at the filename:

Directory;

a,
b,
c,
date#(keepchar(filebasename( ),'0123456789'),'YYYYMMDD') as X
FROM
[temp\allocation\*.xlsx]
(
ooxml,embedded labels, table is [report$]);

regards.janne

2 Replies
mr_janne
New Contributor III

Re: Autoloading a file

Hi,

if the folder really has only a one file then you can use the wildcard at the filename:

Directory;

a,
b,
c,
date#(keepchar(filebasename( ),'0123456789'),'YYYYMMDD') as X
FROM
[temp\allocation\*.xlsx]
(
ooxml,embedded labels, table is [report$]);

regards.janne

Siva_Sankar
Honored Contributor

Re: Autoloading a file

Like the attached one...It used macro.

Regards.

Siva