Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
885
Multi band column sum
posted

Hi,

Following code works fine but for single band grid only, however my grid will have 3 bands. Any sample how to sum single column values across all bands in grid?

Thanks! 

With Me.Grid1.DisplayLayout.Bands(0)

Dim summarySetting As SummarySettings = .Summaries.Add(SummaryType.Sum, Nothing, .Columns(1), SummaryPosition.UseSummaryPositionColumn, Nothing)

summarySetting.DisplayFormat = "${0:#,###}"

summarySetting.Appearance.FontData.Bold = DefaultableBoolean.True

summarySetting.Appearance.TextHAlign = HAlign.Right

End With

 

 

 

Parents
No Data
Reply
  • 469350
    Offline posted

    There's no way to sum three different bands in one operation.

    What I would do is this: 

    • On the last band, you create a summary to sum a column.
    • On the parent of that band, you add an unbound column.
    • Use the InitializeRow event to populate this unbound column with the summary from the child rows.
    • Then you can add a summary to the unbound column and do the same thing on the parent of this band.

    To get the child row summary value, you would do something like this in InitializeRow: 

    e.Row.ChildBands[0].Rows.SummaryValues["My Summary"].Value

     

     

Children