LOGAN
LOGAN

Reputation: 35

My SUM Function - rdlc - custom code -total

I would like to pass a value and add to it with the previous value thats what I want.. The below code doesn't work...I can't understand the problem.. Actually its for rdlc - total purpose I need it. My Code

public MyValue as Decimal=0
public Function AddToSum(ByVal quantity as Decimal) as Decimal
MyValue=AddToSum+quantity
AddToSum=MyValue
return AddToSum
End Function 

Suppose I have a Table field bill_amt 

bill_amt   AddToSum(bill_Amt) should be like the below
15             15
25             40
35             75

Is it possible?

Upvotes: 1

Views: 4227

Answers (2)

Naveen Nair
Naveen Nair

Reputation: 49

@Logan you don't need to write a function for that purpose . A RunningValue() function can be used to generate the AddToSum(bill_Amt). e.g.RunningValue(Fields!bill_amt.Value,Sum,"Group or DataSet Name")

Upvotes: 1

Meta-Knight
Meta-Knight

Reputation: 17875

Not sure what you tried to do with your sample code, but you can simply do this:

Public MyValue as Decimal = 0
Public Function AddToSum(ByVal quantity as Decimal) as Decimal
  MyValue = quantity + MyValue
  Return MyValue
End Function

Upvotes: 1

Related Questions