How to set a dynamically image form a QlikView table?

How to set a dynamically image form a QlikView table?

Scenario: In a QlikView table, each item is associated to an image inside the disk. How to replicate this dynamic association inside BIReport?


Solution: add a Picture Box to the report and while it is selected, open the Script Editor and select the BeforePrint event from the right dropdown menu.

You will get this code inside the script editor area:



Copy the following code inside the curly brackets


string fileName= Convert.ToString(GetCurrentColumnValue("CategoryImage"));

pictureBox1.ImageUrl = ("C:\\" + fileName);

 

Replace the value highlighted in yellow with the column data name that contains the picture position, replace the value highlighted in green so that the image path will be complete. For special characters like the backslash \ use the double backslash \\ to represent it as a string.

Now your code will look like this.

private void pictureBox1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)

{

string fileName= Convert.ToString(GetCurrentColumnValue("CategoryImage"));

pictureBox1.ImageUrl = ("C:\\" + fileName);

}

Close the script and open the print preview.