Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
jwbadger3
Contributor II
Contributor II

Bundle Load Images from a Filepath

This post builds on Chuck Bannon's Loading Images into QlikView post.

This is a great resource to be able to easily leverage images in your QlikView development.

What we've found is that in doing this, you have to then maintain an excel file that keeps your images and your image filepaths in sync. If a file folder moves or an image name changes, the image reference will break.

Instead, what you can do is leverage a little bit of QlikView scripting to read every file of a specific type in a directory and load that into a table to be used.

Temp Test.png

// Start by generating this inline table of the filetypes you're looking to grab from the filepath.

Imgtype:

Load * Inline

  [

  Imgtype

  png,

  jpg,

  gif

  ];

// Here you can set the filepath where your images are stored.

Set vFilePath = 'Images\';

// Here we go...

[Images]:

Load * Inline

[

Imgname, Imgfilepath, Imgtype

];

Let vNumRows = NoOfRows('Imgtype');

For i=1 to $(vNumRows)

  Let vImgtype = FieldValue('Imgtype',$(i));

  

  For each vFile in FileList('$(vFilePath)*.$(vImgtype)')

  let vImgtype = '$(vImgtype)';

  let vImgfilepath = '$(vFile)';

  let vImgname = Left(Right('$(vFile)',len('$(vFile)')-Index('$(vFile)','\',-1)),len(Right('$(vFile)',len('$(vFile)')-Index('$(vFile)','\',-1)))-4);

         Concatenate

  Load * Inline

  [

  Imgname, Imgfilepath, Imgtype

  $(vImgname),$(vImgfilepath), $(vImgtype)

  ];

  next

  let vFile = Null();

  let vImgName = Null();

  next

let vImgtype = Null();

Drop Table Imgtype;

[ImageBundle]:

Bundle

Load

  *

Resident Images;

!

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Nice post. You can also use QlikView Components (http://qlikviewcomponents.org) to load images from a directory:

Call Qvc.Icons('Images')

-Rob

http://masterssummit.com

http://qlikviewcookbook.com