我需要重置MS Reporting Services中每个组的页码。我在MS Reporting Services 2008 R2中了解这种可能性,但我没有可能升级它。
另外,我知道这个MSDN post。但是,存在一个问题。当我向前切换页面时,一切似乎都没问题,但是当后页编号工作错误时。我有这样的页码:
1,0,-1
答案 0 :(得分:0)
经过一番研究,我可以回答这个问题。 算法的想法是设置页码一次,将其保存到数组,然后当我们翻页时,不要从头开始计算,而是从全局页面数组中获取页码。 这个想法很有效,这里有一些代码如何设置这个解决方案
Shared offset as Integer
Shared currentgroup as Object
Shared currentPage as Integer
Shared Dim pagesArray() As Integer
Public Function GetGroupPageNumber(group as Object, pagenumber as Integer, totalpages as Integer) as Object
If Not (group = currentgroup)
offset = pagenumber - 1
currentgroup = group
End If
If (pagesArray Is Nothing) Then
ReDim Preserve pagesArray(totalpages)
End If
If (CountNumberOfElementsInArray(pagesArray) < totalpages)
pagesArray(pagenumber - 1) = pagenumber - offset
End If
Return pagesArray(pagenumber - 1)
End Function
Public Function CountNumberOfElementsInArray(array() As Integer) as Integer
Dim counter as Integer
Dim i As Integer
counter = 0
For i = 0 To array.Length - 1
If (array(i) <> 0)
counter = counter + 1
End If
Next i
Return counter
End Function
您可以在我的博客上找到详细信息 Reset page number in ms reporting services