Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

FileName() Function Limitations?

I try running the following LOAD in Qlikview:

Images:

LOAD

FileBaseName() as BaseName,

FileName() as ImageFile,

FileExtension() as Extension

From D:\QlikView\Images\*;

Against this folder:

2014-02-19_1055.png

and i get the following result:  SO my Question is: Can filename function not read anything besides .jpg adn .xls files? Why is it missing so many files?

2014-02-19_1056.png

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

How may rows did you get? Wen I try your code against a folder with 22 files, I get all extensions -- but 36K rows. The default format spec is "(txt)" so each file may generate multiple rows whilst the LOAD is searching for newline chars.

In your case of the missing files, I'll bet something that looked like an EOF was encountered before any "row" was read.

In any case, your hunch is right. This is not a valid technique to collect filenames from a directory. For that, use FOR EACH IN FILELIST() as you suggested.

-Rob

http://masterssummit.com

View solution in original post

8 Replies
rbecher
MVP
MVP

Hi Patrick,

the LOAD statement itself is to load data files or image files (bundle).

- Ralf

Astrato.io Head of R&D
swuehl
MVP
MVP

Can't reproduce your issue, using your code I get a lot of file extensions:

air

cmd

csv

docx

epub

exe

export

gpx

gwc

gz

ics

iso

jpeg

JPG

jpg

kml

kmz

loc

log

mdb

mht

MOV

mov

mp3

mp4

msu

out

p7s

PDF

pdf

pptx

QVD

qvd

qvd (qvd)

qvd (txt)

qvw

qvx

tex

tgz

txt

WAV

wav

wsdl

xls

xlsm

xlsx

xml

zip

You can also consider using FOR EACH file in FILELIST instead of the wildcard search in the FROM.

Not applicable
Author

Hi Ralf,

Essentially I am trying to build a template where you could drop image files and they will display by looking up certain named files and place them in the right place.  Then I call the image in a text object like '$(vLogoFile)'. Right now it works for any image as long as it is a .jpg, but the pull doesn't recognize .png or .gif files.

So i didnt think i need to bundle the actual images just look up and reference the names and paths, but do you think bundling would give better results?

Images:

LOAD

FileBaseName() as BaseName,

FileName() as ImageFile,

FileExtension() as Extension

From D:\QlikView\Images\*;

LET vLogoFile =  lookup('ImageFile', 'BaseName','TitleBarImage');

Not applicable
Author

Strange that you couldnt replicate but in noticed the only image type extension coming up in your list is jpg, JPEG, and jpeg.


No png, no gif, no bitmap etc, maybe they are not supported?

I will try the FOR EACH in FILELIST and see if that makes it any better.

Thanks

rbecher
MVP
MVP

I would use bundle as a last load instead. Then you can move or deploy the QVW with no disconnected image.

Astrato.io Head of R&D
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

How may rows did you get? Wen I try your code against a folder with 22 files, I get all extensions -- but 36K rows. The default format spec is "(txt)" so each file may generate multiple rows whilst the LOAD is searching for newline chars.

In your case of the missing files, I'll bet something that looked like an EOF was encountered before any "row" was read.

In any case, your hunch is right. This is not a valid technique to collect filenames from a directory. For that, use FOR EACH IN FILELIST() as you suggested.

-Rob

http://masterssummit.com

Not applicable
Author

Thanks Rob,

Any idea why i would get not get results for all the functions ( I think they are valid QV functions):

FOR Each File in filelist ('D:\QlikView\Images\*')

LOAD

'$(File)' as Name,

FileSize( '$(File)' ) as Size,

FileTime( '$(File)' ) as FileTime,

FileBaseName( '$(File)' ) as BaseName,

FileName( '$(File)' ) as ImageFile,

FileExtension( '$(File)' ) as Extension

autogenerate 1;

NEXT File

Returns:

2014-02-19_1055.png

swuehl
MVP
MVP

AFAIR, these functions don't take a filename as argument, but will use the source file of the table load (not existing in your case). Use string functions on the variable like subfield or left/right etc. instead.