How can I loop records so that 2 records per row one on left and other on right, is this possible?

江枫思渺然 提交于 2020-01-30 10:51:14

问题


In my SSRS report, I want to show 2 records in one row, so they each row contian one entry in left and other entry in right. So if there are total 10 records, there should be 5 rows with each row having 2 records each. Is this possible in SSRS? I am using list to achieve it. Please advise.


回答1:


I have a potential solution that could solve your requirement. I recommend utilizing the RowNumber function of SSRS to specify odd numbered items in the first column and even numbered items in the second. So for example, you might use the following expressions.

Column 1:

=IIF(RowNumber(Nothing) Mod 2 = 1, Nothing, Previous(Fields!Data.Value))

Column 2:

=IIF((RowNumber(Nothing) + 1) Mod 2 = 0, Nothing, Fields!Data.Value)

With those expressions, you may also need to add an expression to the row visibility that hides rows that are empty. Something like the following expression will hide the row if both columns contain no data. This should leave you with 5 rows containing your 10 records.

=IsNothing(ReportItems!Textbox1.Value) And IsNothing(ReportItems!Textbox2.Value)

My results:



来源:https://stackoverflow.com/questions/57076070/how-can-i-loop-records-so-that-2-records-per-row-one-on-left-and-other-on-right

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