Question

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?

Was it helpful?

Solution

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

OTHER TIPS

@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")

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top