【问题标题】:How to check if SSRS Textbox is empty如何检查 SSRS 文本框是否为空
【发布时间】:2012-10-05 02:07:56
【问题描述】:

如何在 SSRS 2008 中检查文本框是否为空? 这段代码我试过了,还是不行。

IIF(ReportItems!txtCountVolunter.Value = "", false, true)

【问题讨论】:

    标签: ssrs-2008 reporting-services ssrs-tablix


    【解决方案1】:

    尝试以下方法:

    =IIF(Len(ReportItems!txtCountVolunteer.Value) <= 0, true, false) 
    

    【讨论】:

      【解决方案2】:

      你应该使用这个表达式

      =IIF(IsNothing(Fields!UserEmail.Value) OR Fields!UserEmail.Value = "",
       "Empty", "Not Empty")
      

      第一个:IsNothing(Fields!UserEmail.Value) 检查字段值是否为NULL 第二种:Fields!UserEmail.Value = ""检查字段值是否为空""

      所以你需要他们两个来检查值是空还是空。

      【讨论】:

        【解决方案3】:

        检查是否为空

        =IIF(IsNothing(ReportItems!txtCountVolunteer.Value),true, false) 
        

        【讨论】:

          【解决方案4】:

          试试这样的 IsNothing 函数:

          IIF(IsNothing(ReportItems!txtCountVolunter.Value), "empty", "not empty")
          

          【讨论】:

            【解决方案5】:

            虽然之前的答案是正确的,但它们有点多余。只要这样就足够了:

            =String.IsNullOrEmpty(Fields!txtCountVolunteer.Value)
            

            判断值是否不为空:

            =NOT String.IsNullOrEmpty(Fields!txtCountVolunteer.Value)
            

            如果您使用表达式来指示可见性,请记住,当字段应隐藏(默认为可见)时,表达式应评估为真。在我意识到这一点之前,我花了一个多小时来解决我自己的表情问题。

            在我的示例中,如果我有一个空或空字符串值,我将隐藏批号:Visibility Expression Screenshot

            【讨论】:

              【解决方案6】:

              对于那些来自 .NET 世界并且您想检查非空并说为了参数而希望值 0 而不是空白的人!

              =IIf(String.IsNullOrEmpty(ReportItems!txtCountVolunteer.Value), 0, ReportItems!txtCountVolunteer.Value)
              

              【讨论】:

                【解决方案7】:

                如果您在数据集中使用转换和空值,则可以执行此操作(我已将存储过程作为源):

                =CInt(IIF(Parameters!Seller_id.Value = "" , "-1" , Parameters!Seller_id.Value))  
                

                然后在存储过程中添加条件

                ([some_field]=@param or @param=-1)
                

                【讨论】:

                  猜你喜欢
                  • 1970-01-01
                  • 1970-01-01
                  • 2014-02-14
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 2022-01-09
                  • 1970-01-01
                  相关资源
                  最近更新 更多