zoukankan      html  css  js  c++  java
  • Reporting Service表达式与报表函数

    假定客户有这样一个需求,需要根据条件使得报表字段底色进行相应变化。

    有以下三种解决方法:


    1.根据数据行内容设置:

    在字段属性当中找到BackgroundColor


    输入判断式:=IIF(Fields!CUST_CODE.Value="XX",White,Blue)     --//如果公司名称为XX,则底色为白,否则为黑


    2.根据行号设置:

    同样是修改字段表达式:=IIF(Runningvalue(Fields!Fiscal Month Name.Value, countdistinct, nothing), White, Blue) --//Runningvalue函数用以计算行号


    3.使用报表函数:

    点击报表属性


    在代码标签页下编辑自定义函数



    Public Shared ReverseLookup = True
    Public Function GetColor(ByVal currentValue As String, ByVal previosValue As String) As String
        If ReverseLookup = True
            If currentValue = previosValue Then
                    GetColor = "White"
            Else
                    GetColor = "LightBlue"
                    ReverseLookup = False
            End If
        Else
            If currentValue = previosValue Then
                    GetColor = "LightBlue"
            Else
                    GetColor = "White"
                    ReverseLookup = True
            End If
        End If
    End Function

    并且将字段表达式改为 =Code.GetColor(Fields!GLOBAL_ID.Value, Previous(Fields!GLOBAL_ID.Value)) ,最终效果如下:

    使用报表函数可以实现跨行比较,遇到不同值才变色。


    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    ESlint 格式化代码 备忘
    css 点击样式,水波纹(记录备用)
    RabbitMq 报错记录
    sql For xml path('') 备忘
    .net core Area独立成单独的dll文件
    刷shipid 简便方法
    实际操作--create DB link
    POS VB
    设置PL/SQL 快捷键
    要开始学习C#
  • 原文地址:https://www.cnblogs.com/larryqian86/p/4695593.html
Copyright © 2011-2022 走看看