Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
jwbadger3
New 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

Re: Bundle Load Images from a Filepath

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

Community Browser