SSRS Images in 3 by 3 format in a matrix

孤街浪徒 提交于 2019-12-26 08:56:05

问题


I have a stored procedure which returns Id, FileContent and description of Images used in a project. I have a requirement to display the images in 3 by 3 format . I know we can do it in a table either vertically or horizontally but how can i get it 3 by 3 like below.

Image1 Image2 Image 3  
Image4 Image5 Image 6

回答1:


this is little bit tricky ... try to get output of SQL query like this

Declare @Image AS Table(ImageName Varchar(50))
Declare @N AS INT
Set @N=3 -- N X N Matrix
Insert into @Image Values('Image1'),('Image2'),('Image3'),
                         ('Image4'),('Image5'),('Image6'),
                         ('Image7'),('Image7'),('Image8')
Select *,
 Case   (RowNum % @N)
 When 0 then Char(64 + RowNum / @N)
 ELSE Char(65 + RowNum / @N) END AS Grp

 From
(Select row_number() Over(order by Imagename) AS RowNum,ImageName  From @Image
) Result

See output looks like

now what you have to do take a matrix and do a row grouping by [grp] column & column grouping on ImageName...

your report will look like; cheers :-)



来源:https://stackoverflow.com/questions/26757132/ssrs-images-in-3-by-3-format-in-a-matrix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!