Sum of Column Values in Table - Rdlc report

后端 未结 2 544
慢半拍i
慢半拍i 2021-01-21 07:13

I have a Table in Rdlc report with 6 Columns and a dataset. A dll is added ( referenced ) to the Report, named RepHlpr.dll. This dll have a shared function GetPar which

2条回答
  •  佛祖请我去吃肉
    2021-01-21 07:50

    You can apply Sum on your formula of that textbox instead of trying to apply it on the value of textbox:

    =Sum(Code.YourMethod(Fields!Filed1.Value, Fields!Filed2, otherParam), "YourDataSetName")
    

    For example if name of your report data set is "DataSet1"

    Sum(RepHlpr.RepHlpr.GetPar("Amt", Fields!hp.Value, Fields!make.Value), "DataSet1")
    

    Example

    I created a Code function:

    Public Function Multiply(ByVal value As Integer, factor As Integer) As Integer
        Return value * factor
    End Function
    

    Then I set expression for my extra column that is not data bound:

    =Code.Multiply(Fields!Price.Value, 2)
    

    Then I added a TextBox and set its Sum expression based on my custom column expression:

    =Sum(Code.Multiply(Fields!Price.Value, 2), "DataSet1")
    

    And here is the screenshot:

提交回复
热议问题