在 Reporting Services 2005 中按自定义代码筛选列表?
你能做到吗?我想使用的列表过滤器如下所示:
Expression Operator Value
=Code.GetOccCat(Fields!accountnumber.Value) = =1
没有骰子。基本上,就过滤器而言,它的行为就像该函数返回 null,但是当我关闭过滤器并将完全相同的函数调用放入列表内的文本框中时,它会返回它应该返回的内容。你能不能不要这样做,或者我错过了什么?
编辑:这是函数,非常简单:
Public Function GetOccCat(ByVal AccountNum As Integer) As Integer
Return OccCat(AccountNum)
End Function
OccCat 是一个公共整数数组,通过之前的函数调用填充。同样,如果我只是将其放入文本框中,则会显示正确的值,因此数组被验证为正确填充。
编辑:数组通过报告顶部的列表填充。该列表在帐号上重复,没有过滤器。列表内部是一个包含以下代码的文本框:
=Code.SetOccupancy(Fields!accountnumber.Value, First(Fields!new_total_hours.Value)/First(Fields!new_capacity.Value))
这是该函数:
Public Function SetOccupancy(ByVal AccountNum As Integer, ByVal Occ As Double) As String
Occupancy(AccountNum) = Occ
Select Occ
Case Is > .85
OccCat(AccountNum) = 1
Case .7 to .849
OccCat(AccountNum) = 2
Case .4 to .699
OccCat(AccountNum) = 3
Case Is < .4
OccCat(AccountNum) = 4
End Select
Return ""
End Function
FWIW,我还尝试了基于占用数组的过滤器(在本例中为 > .85)并得到了相同的结果。
Can you do this? The list filter I want to use looks like this:
Expression Operator Value
=Code.GetOccCat(Fields!accountnumber.Value) = =1
No dice. Basically, it acts like that function returns null as far as the filter is concerned, but when I take the filter off and put the exact same function call in a text box within the list, it returns what it's supposed to return. Can you just not do this, or what am I missing?
Edit: here's the function, completely simple:
Public Function GetOccCat(ByVal AccountNum As Integer) As Integer
Return OccCat(AccountNum)
End Function
OccCat is a public array of integers that is filled via an earlier function call. Again, the correct values display if I just put this in a text box, so the array is verified to be filling up correctly.
Edit: the array gets populated by way of a list at the top of the report. The list repeats on accountnumber with no filter. Inside the list is a textbox containing this code:
=Code.SetOccupancy(Fields!accountnumber.Value, First(Fields!new_total_hours.Value)/First(Fields!new_capacity.Value))
And here's that function:
Public Function SetOccupancy(ByVal AccountNum As Integer, ByVal Occ As Double) As String
Occupancy(AccountNum) = Occ
Select Occ
Case Is > .85
OccCat(AccountNum) = 1
Case .7 to .849
OccCat(AccountNum) = 2
Case .4 to .699
OccCat(AccountNum) = 3
Case Is < .4
OccCat(AccountNum) = 4
End Select
Return ""
End Function
FWIW, I've also tried this filter based on the Occupancy array (being > .85 in this case) and gotten the same result.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你能在你的代码中展示你的功能吗?
我刚刚检查过它,它确实可以过滤掉自定义代码。虽然我没有完全使用你的,因为我不太明白你想要过滤的内容。
您想按哪个字段进行过滤?
我认为您只是将表达式代码放在错误的位置。基本上,将您想要过滤的字段放入下拉的表达式框中。然后将 =code.getocccat(my value) 放入值表达式中。
尝试一下并让我知道,但它确实有效。我认为你的位置有点偏。
Could you show your function in your code?
I just checked it, and it certainly works to filter off of custom code. Though I didn't use yours exactly because I don't quite understand what you are trying to filter by.
Which field are you wanting to filter by?
I think you are just putting your code for your expression in the wrong place. Basically, put the field you want to filter by in the expression box that drops down. Then place your =code.getocccat(my value) in the value expression.
Try this and let me know, but it certainly works. I think you have the placement a little off.