Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
344 views
in Technique[技术] by (71.8m points)

reporting services - SSRS Images in 3 by 3 format in a matrix

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

enter image description here

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 :-)

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...