Displaying totals ( count)

Hi 

I have used the code supplied for printing totals at the grid bottom

I replaced the Column name with the respective one in my grid 

The code works partially because it does not display the number of count 

=========================================================
Your suggested code
Dim tableSummaryRow1 As New GridTableSummaryRow()
tableSummaryRow1.Name = "TableSummary"
tableSummaryRow1.ShowSummaryInRow = True
tableSummaryRow1.Title = " Total Product Count: {ProductName}"
tableSummaryRow1.Position = VerticalPosition.Bottom

Dim summaryColumn1 As New GridSummaryColumn()
summaryColumn1.Name = "TotalProduct"
summaryColumn1.SummaryType = SummaryType.DoubleAggregate
summaryColumn1.Format = "{Count}"
summaryColumn1.MappingName = "ProductName"

tableSummaryRow1.SummaryColumns.Add(summaryColumn1)

Me.sfDataGrid1.TableSummaryRows.Add(tableSummaryRow1)
The only change in my code is the column name. Replaced ProductName with my column and the result below

How can I solve this? 

5 Replies

VS Vijayarasan Sivanandham Syncfusion Team April 28, 2020 10:09 AM UTC

Hi GeorgeNas,

Thank you for contacting Syncfusion support.

Your requirement can be achieved by defining the GridSummaryColumn.Name Property in GridSummaryRow.Title. Please refer the below code snippet,
 
Dim tableSummaryRow1 As New GridTableSummaryRow() 
tableSummaryRow1.Name = "TableSummary" 
tableSummaryRow1.ShowSummaryInRow = True 
tableSummaryRow1.Title = " Total Product Count: {TotalProduct}" 
tableSummaryRow1.Position = VerticalPosition.Bottom 
 
Dim summaryColumn1 As New GridSummaryColumn() 
summaryColumn1.Name = "TotalProduct" 
summaryColumn1.SummaryType = SummaryType.DoubleAggregate 
summaryColumn1.Format = "{Count}" 
summaryColumn1.MappingName = "ProductName" 
 
tableSummaryRow1.SummaryColumns.Add(summaryColumn1) 
Me.sfDataGrid.TableSummaryRows.Add(tableSummaryRow1) 

We are revamping our help site and it will be available online by tomorrow.

Please let us know, if you require further assistance on this.

 
Regards,
Vijayarasan S
 



GE GeorgeNas April 28, 2020 11:04 AM UTC

Thanks you for your reply 

It would be even better if you clarify the following 

When the user query is for example

Select  SupCode   [Supplier Code],
            SupName  [Supplier Name],
etc 
from TBSup   

in order to give meaningfull column headers for the grid 

then the summaryColumn1.MappingName must be equal the alias of the actually selected field  without the brackets
summaryColumn1.MappingName = "Supplier Code"

It is a redundancy due to the term MappingName but I believe it helps

Thank you



VS Vijayarasan Sivanandham Syncfusion Team April 29, 2020 03:58 PM UTC

Hi GeorgeNas,


Thanks for the update.


We are unable to understand your query. Can you please provide the more information related to your query. 
It will be helpful for us to check on it and provide you the solution at the earliest.

Regards,
Vijayarasan S




GE GeorgeNas April 29, 2020 04:41 PM UTC

In my database the fields names are in english

But I write code to be used bu Greek audience 

Therefore I have to use meanigfull greek names for the column Headers 

Select SuPid [Κωδ.Πελάτη]  ,
           SupName  [Επωνυμία] 
from Suppliers 

To assign the greek "titles" for the grid columns and have the special greek characters appear I have to include in brackets the greek title 

But for the Totals Line  of such a column It must be referred without the brackets
summaryColumn1.MappingName = "Κωδ.Πελάτη" 'if I want totals for the SUPid column that has a greek alias for the grid
That was my point to cover the case for other displaying languages than english

Thank you for your interest




VS Vijayarasan Sivanandham Syncfusion Team April 30, 2020 02:16 PM UTC

Hi GeorgeNas,

Thanks for the update.

We suspect that you need to display the ColumnHeader in Greek. Your requirement can be achieved by set HeaderText property in GridColumn in Greek and set the MappingName in English to populate the data. 
this.sfDataGrid.Columns.Add(new GridTextColumn() 
{ 
                MappingName = "CustomerName", 
                HeaderText = "Κωδ.Πελάτη" 
}); 
 
Please refer the below image for your reference, 

 
Regards,
Vijayarasan S
 


Loader.
Up arrow icon