8 Replies Latest reply: Feb 19, 2014 6:45 PM by Stefan Wühl RSS

    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

        • Re: FileName() Function Limitations?
          Ralf Becher

          Hi Patrick,

           

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

           

          - Ralf

            • Re: FileName() Function Limitations?

              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');

            • Re: FileName() Function Limitations?
              Stefan Wühl

              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.

                • Re: FileName() Function Limitations?

                  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

                    • Re: FileName() Function Limitations?
                      Rob Wunderlich

                      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

                        • Re: FileName() Function Limitations?

                          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