The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
For some reason, one of my columns I'm doing a summary on is returning a value of 0. There are quite a few rows that might be 0 but not all of them. See the code I used below to add the summary row.
Dim SummaryRow As GridSummaryRowDescriptor = New GridSummaryRowDescriptor("Summary") Dim AddedSummaryField As Boolean = False Dim sc() As GridSummaryColumnDescriptor For I = 0 To Groups.Length - 1 If Groups(I).FieldName <> Nothing Then ReDim Preserve sc(I) sc(I) = New GridSummaryColumnDescriptor(Groups(I).FieldName, SummaryType.DoubleAggregate, Groups(I).FieldName, "{Sum}") sc(I).Appearance.AnyCell.HorizontalAlignment = GridHorizontalAlignment.Right sc(I).DisplayColumn = Groups(I).FieldName SummaryRow.SummaryColumns.Add(sc(I)) AddedSummaryField = True End If Next
SummaryRow.Visible = False
If AddedSummaryField Then Dim OrdersDescriptor As GridTableDescriptor = ggc1.TableDescriptor OrdersDescriptor.ChildGroupOptions.ShowCaptionSummaryCells = True OrdersDescriptor.ChildGroupOptions.CaptionSummaryRow = "Summary" OrdersDescriptor.SummaryRows.Add(SummaryRow) OrdersDescriptor.ChildGroupOptions.ShowSummaries = False ggc1.Appearance.GroupCaptionCell.BackColor = ggc1.Appearance.RecordFieldCell.BackColor ggc1.Appearance.GroupCaptionCell.Borders.Top = New GridBorder(GridBorderStyle.Standard) 'ggc1.Appearance.GroupCaptionCell.Borders.All = New GridBorder(GridBorderStyle.Standard) ggc1.Appearance.GroupCaptionCell.CellType = "Static" ggc1.TableOptions.CaptionRowHeight = ggc1.TableOptions.RecordRowHeight ggc1.TableOptions.SummaryRowHeight = ggc1.TableOptions.RecordRowHeight
If curQuery = "ShortShip" Then OrdersDescriptor.ChildGroupOptions.ShowSummaries = True 'ggc1.TableDescriptor.ChildGroupOptions.ShowColumnHeaders = True For X As Integer = 0 To ggc1.TableDescriptor.SummaryRows.Count - 1 ggc1.TableDescriptor.SummaryRows.Item(X).Visible = True For c As Integer = 0 To ggc1.TableDescriptor.SummaryRows.Item(X).SummaryColumns.Count - 1 ggc1.TableDescriptor.SummaryRows.Item(X).SummaryColumns.Item(c).SummaryDescriptor.IgnoreRecordFilterCriteria = True ggc1.TableDescriptor.SummaryRows.Item(X).SummaryColumns.Item(c).Style = GridSummaryStyle.Column ggc1.TableDescriptor.Columns(c).GroupByOptions.ShowSummaries = True Next 'ggc1.TableDescriptor.SummaryRows.Item(X).SummaryColumns.Count Next End If
I put this below code in to return the values...
For Each el As Element In ggc1.Table.DisplayElements If TypeOf el Is GridSummaryRow Then Dim sr As GridSummaryRow = TryCast(el, GridSummaryRow) If sr IsNot Nothing Then For Each scd As GridSummaryColumnDescriptor In sr.SummaryRowDescriptor.SummaryColumns Debug.Print("{0} = {1}", scd.Name, GridEngine.GetSummaryText(sr.ParentGroup, scd))
Next End If End If Next
Being that I'm using a DataTable, I added my own summary text that added the value of the column up every time it read the next row in the DataReader. My result was exactly the same as the first summary that is working, but I was able to bring back the correct count with my summary value whereas the built-in summary brings back 0.
GridGroupingControl with a datasource = DataTable. Using SQL with a DataReader.
Of course I posted prematurely. The column was mispelled.
>For some reason, one of my columns I'm doing a summary on is returning a value of 0. There are quite a few rows that might be 0 but not all of them. See the code I used below to add the summary row.
Dim SummaryRow As GridSummaryRowDescriptor = New GridSummaryRowDescriptor("Summary") Dim AddedSummaryField As Boolean = False Dim sc() As GridSummaryColumnDescriptor For I = 0 To Groups.Length - 1 If Groups(I).FieldName <> Nothing Then ReDim Preserve sc(I) sc(I) = New GridSummaryColumnDescriptor(Groups(I).FieldName, SummaryType.DoubleAggregate, Groups(I).FieldName, "{Sum}") sc(I).Appearance.AnyCell.HorizontalAlignment = GridHorizontalAlignment.Right sc(I).DisplayColumn = Groups(I).FieldName SummaryRow.SummaryColumns.Add(sc(I)) AddedSummaryField = True End If Next
SummaryRow.Visible = False
If AddedSummaryField Then Dim OrdersDescriptor As GridTableDescriptor = ggc1.TableDescriptor OrdersDescriptor.ChildGroupOptions.ShowCaptionSummaryCells = True OrdersDescriptor.ChildGroupOptions.CaptionSummaryRow = "Summary" OrdersDescriptor.SummaryRows.Add(SummaryRow) OrdersDescriptor.ChildGroupOptions.ShowSummaries = False ggc1.Appearance.GroupCaptionCell.BackColor = ggc1.Appearance.RecordFieldCell.BackColor ggc1.Appearance.GroupCaptionCell.Borders.Top = New GridBorder(GridBorderStyle.Standard) 'ggc1.Appearance.GroupCaptionCell.Borders.All = New GridBorder(GridBorderStyle.Standard) ggc1.Appearance.GroupCaptionCell.CellType = "Static" ggc1.TableOptions.CaptionRowHeight = ggc1.TableOptions.RecordRowHeight ggc1.TableOptions.SummaryRowHeight = ggc1.TableOptions.RecordRowHeight
If curQuery = "ShortShip" Then OrdersDescriptor.ChildGroupOptions.ShowSummaries = True 'ggc1.TableDescriptor.ChildGroupOptions.ShowColumnHeaders = True For X As Integer = 0 To ggc1.TableDescriptor.SummaryRows.Count - 1 ggc1.TableDescriptor.SummaryRows.Item(X).Visible = True For c As Integer = 0 To ggc1.TableDescriptor.SummaryRows.Item(X).SummaryColumns.Count - 1 ggc1.TableDescriptor.SummaryRows.Item(X).SummaryColumns.Item(c).SummaryDescriptor.IgnoreRecordFilterCriteria = True ggc1.TableDescriptor.SummaryRows.Item(X).SummaryColumns.Item(c).Style = GridSummaryStyle.Column ggc1.TableDescriptor.Columns(c).GroupByOptions.ShowSummaries = True Next 'ggc1.TableDescriptor.SummaryRows.Item(X).SummaryColumns.Count Next End If
I put this below code in to return the values...
For Each el As Element In ggc1.Table.DisplayElements If TypeOf el Is GridSummaryRow Then Dim sr As GridSummaryRow = TryCast(el, GridSummaryRow) If sr IsNot Nothing Then For Each scd As GridSummaryColumnDescriptor In sr.SummaryRowDescriptor.SummaryColumns Debug.Print("{0} = {1}", scd.Name, GridEngine.GetSummaryText(sr.ParentGroup, scd))
Next End If End If Next
Being that I'm using a DataTable, I added my own summary text that added the value of the column up every time it read the next row in the DataReader. My result was exactly the same as the first summary that is working, but I was able to bring back the correct count with my summary value whereas the built-in summary brings back 0.
GridGroupingControl with a datasource = DataTable. Using SQL with a DataReader.