[英]How to use concatenate command in SSRS “Code.SumLookup(LookupSet)” function?
The custom code nested in report properties : 嵌套在报表属性中的自定义代码:
Function SumLookup(ByVal items As Object()) As Decimal
If items Is Nothing Then
Return Nothing
End If
Dim suma As Decimal = New Decimal()
Dim ct as Integer = New Integer()
suma = 0
ct = 0
For Each item As Object In items
suma += Convert.ToDecimal(item)
ct += 1
Next
If (ct = 0) Then return 0 else return suma
End Function
My command like this : 我的命令是这样的:
=Code.SumLookup(LookupSet("9040101", Fields!norek.Value,Fields!tgl10.Value, "NR_01"))
if I run that command the result is not error. 如果我运行该命令,则结果不是错误。 the value will be 100
该值将是100
than 比
I just want to make Fields!tgl10.Value
dynamically change when the parameters also change. 我只想让
Fields!tgl10.Value
在参数也更改时动态更改。 so I changed it 所以我改变了
from : Fields!tgl10.Value
to : "Fields!tgl" & parameters!nm_kolom.Value & ".Value"
从:
Fields!tgl10.Value
到: "Fields!tgl" & parameters!nm_kolom.Value & ".Value"
become this 变成这个
=Code.SumLookup(LookupSet("1040101", Fields!norek.Value, "Fields!tgl" & parameters!nm_kolom.Value & ".Value", "NR_01"))
but I found an #error instead 但是我发现了一个#error
Is there any missing from the my new command? 我的新命令中是否缺少任何内容?
Thank You Regardz 谢谢Regardz
The result of your concatenated expression will by a string, but not a field reference. 串联表达式的结果将是字符串,而不是字段引用。 Try this instead:
尝试以下方法:
Fields("tgl" & Parameters!nm_kolom.Value).Value
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.