Link to home
Start Free TrialLog in
Avatar of skaleem1
skaleem1Flag for Canada

asked on

Reporting Services - How to change the image size dynamically based on the number of columns parameter

I have a report that displays different number of images based on how many parts are passed as input parameter. The report accepts a string of comma delimited part numbers as a single imput parameter and then returns the images in a matrix format of rows and columns. The number of part numbers embedded in the string passed as input parameter is unknown. I want to make sure that the size of image reduces or increases based on the number of part numbers passed (BTW each part number has one associated image). I am passing the number of part numbers as a separate second parameter to the report. Is it possible to increase or reduce the size of the iamge based on that second parameter. E.g. if the second parameter value is 4, then the image size should be 5px by 5px, if the second parameter value is 8 then the image size should be 2px by 2px. etc.

If yes, would I have to use the second parameter value in exprsssion of the image control or any other parent control, such as list control or Matrix control? If yes how can I achieve that?
Avatar of skaleem1


I do not see any direct relation with the issue I am asking with the links you have sent. May be I missed the relevant sections. Can you please direct me there?

My initial thought was to change width/height dynamically but its SSRS doesn't support expressions on columns/rows or image width/height.

You also cannot use expression on subreport names but I think you might be able to add several different matrix reports to your subreport (with different image size and number of columns and display only one using visibility so if you have:

3x3 and you have matrix report 2x2, 3x3, 4x4 then when you pass the parameter it should actually tell you which one to use. @Matrix if 1 then 2x2 if 2 then 3x3 if 3 then 4x4 so the @matrix will be used in matrix table visibility property.

Hope that makes sense and helps.

Let me know if you need more info on that (I won't be able to reply today)

Can you show me one expression for (say) the case when parameter provided is 4, then use the first Matrix in the subreport, the one that has 2X2 image layout? One example will help...
Avatar of itcouple
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This one really helped. I have now three seprate Matrix controls in the sub report. As an example, one of the expression in the Visibility of one Matrix is as follows:

=IIF(Parameters!ImageCount.Value > 4 and Parameters!ImageCount.Value <= 6, false, true)

and it works great. Thanks a lot emil.