Infrared UltraGrid total cost per cell
I have this ultraGrid:
http://s4.postimg.org/fhnjs4w4d/Capture.png
I need to pass a custom value from the red-labeled column in the picture to the final cell.
Infragistics allows me to put Max, Min, Sum, Average, etc. to the summary cell, but I need to pass a custom value.
Any help?
I have this code that puts the Max value:
Dim columnToSummarizeVlrAq As UltraGridColumn = ugbBens.DisplayLayout.Bands(0).Columns(ugbBensColVlrAq)
Dim summaryVlrAq As SummarySettings = .Add(ugbBensColVlrAq,SummaryType.Maximum, columnToSummarizeVlrAq, SummaryPosition.UseSummaryPositionColumn)
Here's the solution:
Create a new class:
Public Class MyCustomSummarySettings
Implements ICustomSummaryCalculator
Private valor As Object = 0
Public Sub New()
End Sub
Public Sub Val()
End Sub
Private Sub BeginCustomSummary(ByVal summarySettings As SummarySettings, ByVal rows As RowsCollection) Implements ICustomSummaryCalculator.BeginCustomSummary
valor = 0
End Sub
Private Sub AggregateCustomSummary(ByVal summarySettings As SummarySettings, ByVal row As UltraGridRow) Implements ICustomSummaryCalculator.AggregateCustomSummary
'Primeiro mês
If summarySettings.Key = "COL_DeprAntExVlrRv" Then
If row.Index = 0 Then valor = CDbl(row.Cells("COL_DeprAntExVlrRv").Value)
End If
If summarySettings.Key = "fltVlrDepreciavelAct" Then
If row.Index = 0 Then valor = CDbl(row.Cells("fltVlrDepreciavelAct").Value)
End If
End Sub
Private Function EndCustomSummary(ByVal summarySettings As SummarySettings, ByVal rows As RowsCollection) As Object Implements ICustomSummaryCalculator.EndCustomSummary
Return valor
End Function
End Class
And call the class with a custom pivot type like:
Dim custumSummary As New MyCustomSummarySettings summaryDepreciavel = .Add(ugbBensColDepreciavelAceite, SummaryType.Custom, custumSummary, columnToSummarizeDepreciavel, SummaryPosition.UseSummaryPositionColumn, Nothing) '7ª Coluna
+3
source to share