Alas the code needs to be in VB.NET, cant have everything!
Heres some example VB.NET code. The following comes from an OLAP report
________________________________________________________________
Public SumOfNAV As Double
Public strTest As String
Public strTest As String
Public Function SumUp(ByVal Value As Double)
SumOfNAV = SumOfNav + Value
End Function
SumOfNAV = SumOfNav + Value
End Function
' Keep a total of the GrossExposure
Private GrossExpList As New System.Collections.Hashtable()
Private GrossExpList As New System.Collections.Hashtable()
'Used only as a key to determine when to sum
Private FundNavDailyList As New System.Collections.Hashtable()
'Used to contain the current sum of Total Fund Nav
Private FundNavSumList As New System.Collections.Hashtable()
Private FundNavDailyList As New System.Collections.Hashtable()
'Used to contain the current sum of Total Fund Nav
Private FundNavSumList As New System.Collections.Hashtable()
'Gross Exposure Summary Calcs
Public Function SumUpGrossValue(ByVal Key As String, ByVal Value as Double)
If GrossExpList.ContainsKey(Key) Then
GrossExpList.Item(Key) = GrossExpList .Item(Key) + Value
Else
GrossExpList.Add(Key, Value)
End If
End Function
Public Function TotalGrossValue (ByVal Key As String) As Double
If GrossExpList.ContainsKey(Key) Then
Return GrossExpList.Item(Key)
Else
Return 0
End If
End Function
If GrossExpList.ContainsKey(Key) Then
Return GrossExpList.Item(Key)
Else
Return 0
End If
End Function
' Fund Nav Summary Total Calcs
Public Function SumUpFundNavValue(ByVal DailyKey As String, ByVal SumKey As String, ByVal Value as Double)
If FundNavDailyList.ContainsKey(DailyKey) Then
If FundNavSumList.ContainsKey(SumKey) Then 'already exists do nothing
strTest = "abc"
Else 'add the new value to the list
FundNavSumList.Item(SumKey) = FundNavSumList.Item(SumKey)
End If
Else 'this is a new days nav figure so we should add it to the daily list and check to see if it needs adding to the summary list too
FundNavDailyList.Add(DailyKey, Value)
Public Function SumUpFundNavValue(ByVal DailyKey As String, ByVal SumKey As String, ByVal Value as Double)
If FundNavDailyList.ContainsKey(DailyKey) Then
If FundNavSumList.ContainsKey(SumKey) Then 'already exists do nothing
strTest = "abc"
Else 'add the new value to the list
FundNavSumList.Item(SumKey) = FundNavSumList.Item(SumKey)
End If
Else 'this is a new days nav figure so we should add it to the daily list and check to see if it needs adding to the summary list too
FundNavDailyList.Add(DailyKey, Value)
If FundNavSumList.ContainsKey(SumKey) Then 'already exists so add to running total
FundNavSumList.Item(SumKey) = FundNavSumList.Item(SumKey) + Value
Else 'add the new value to the list
FundNavSumList.Add(SumKey, Value)
End If
End If
End Function
FundNavSumList.Item(SumKey) = FundNavSumList.Item(SumKey) + Value
Else 'add the new value to the list
FundNavSumList.Add(SumKey, Value)
End If
End If
End Function
Public Function TotalFundNavValue (ByVal Key As String) As Double
If FundNavSumList.ContainsKey(Key) Then
Return FundNavSumList.Item(Key)
Else
Return 0
End If
End Function
If FundNavSumList.ContainsKey(Key) Then
Return FundNavSumList.Item(Key)
Else
Return 0
End If
End Function
________________________________________________________________
No comments:
Post a Comment