Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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:
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?
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
Hi Patrick,
the LOAD statement itself is to load data files or image files (bundle).
- Ralf
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
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.
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');
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
I would use bundle as a last load instead. Then you can move or deploy the QVW with no disconnected image.
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
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:
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.