user3676641
user3676641

Reputation: 51

SSRS - Dynamically Ordered Images

I have a report that is displaying a single customer Order and we have a section at the bottom that must display thumbnail images of the items the customer has ordered.

There are between 1-20 items that can be ordered and we would like to display up to 4 images per line, which means there would be a maximum of 5 lines if the customer ordered all 20 items. Alternatively, if they ordered 3 items then there would be one line containing the 3 images and so on.

Is this possible in SSRS?

Upvotes: 0

Views: 309

Answers (1)

Jonnus
Jonnus

Reputation: 3038

If your images were to also return an identifier such as image order number you could use this to organise the 20 images in a matrix

For example using the following Dataset this will create a 3x2 grid of strings. You should be able to adapt this approach to instead display a 5x4 grid of images by changing the data types accordingly.

ImageData   RowNumber
AAAA        1
BBBB        2
CCCC        3
DDDD        4
EEEE        5
FFFF        6
  1. Create a Matrix, and set the Data Field to be the Image Data.

  2. Right Click the Row header and select Row Group -> Group Properties and set the Group on expression to be

    =CInt(Floor((Fields!RowNumber.Value -1) /3))
    
  3. Similarly, Right Click the column header and select Column Gorup- > Group Properties and set the Group on expression to be

    =Fields!RowNumber.Value MOD 3
    

When run, the report will look as follows

enter image description here

You could change the 3 values in the expressions to 5 to give 5 columns of images. Also, if you set the Row 1 and Column 1 to have their visibility of hidden they will no longer display.

Hopefully you can use this method to generate the desired outcome. Please let me know if you require further assistance.

Upvotes: 1

Related Questions