【问题标题】:Compare two strings value in rdl file比较rdl文件中的两个字符串值
【发布时间】:2015-07-01 08:13:36
【问题描述】:

我需要检查 rdl <code> 文件中两个字符串的相等性。

以下条件仅检查两者或 Null 值。但我需要检查参数值是否相等。

以下函数是在<code></code> 块中编写的自定义函数。 请帮忙。

NPServedasperPolicyNPServed 参数值来自报告值。

   public function getNoticePeriodStatus
        (byval NPServed as String,byval NPServedasperPolicy as String)


        if(NPServedasperPolicy = NPServed)
                getNoticePeriodStatus = "Notice period Fully Served"
        end if

【问题讨论】:

  • 如果值不相等怎么办?
  • Not Equal 表示将值设置为 getNoticePeriodStatus="Notice period Not Served."
  • 如果两者都为空?
  • 是的,两者都为空或不相等。

标签: reporting-services ssrs-2008 rdl custom-code


【解决方案1】:

假设你要显示:

  • 如果NPServedasperPolicyNPServed 不同或两者都为null,则显示“Notice period Not Served”
  • 如果NPServedasperPolicyNPServed 相等,则“通知期已满”

您可以使用以下自定义代码:

Public Function GetNoticePeriodStatus (ByVal NPServed as String,ByVal NPServedasperPolicy as String)
        If((Not(NPServedasperPolicy Is Nothing) And Not(NPServed Is Nothing)) and NPServedasperPolicy = NPServed) Then
                GetNoticePeriodStatus = "Notice period Fully Served"
        Else
                GetNoticePeriodStatus = "Notice period Not Served"
        End If
End Function

可以这样调用:

=Code.GetNoticePeriodStatus(Parameters!NPServed.Value, Parameters!NPServedasperPolicy.Value)

为了完整起见,这里是纯表达式等价物:

=Iif((Not(Parameters!NPServedasperPolicy.Value Is Nothing) And (Not(Parameters!NPServed.Value Is Nothing))) And Parameters!NPServedasperPolicy.Value = Parameters!NPServed.Value, "Notice period Fully Served", "Notice period Not Served")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-05-31
    • 1970-01-01
    • 2013-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多