We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Summary Values and Group values

Thread ID:

Created:

Updated:

Platform:

Replies:

62363 Jun 13,2007 05:01 PM UTC Jun 27,2007 01:59 PM UTC WinForms 10
loading
Tags: GridControl
Anju
Asked On June 13, 2007 05:01 PM UTC

Hi,
We are facing Following issues

1. We have populated the Summary cells in our grid with values that were calculated using custom formulas. We want to read/iterate these summary values from the grid.

The following code below returns the SUM value as summary value;instead of the calculated value displayed in the GRID

GridSummaryRow oSR = ((GridSummarySection)(oSubGrp.Summary)).SummaryRows[0];
GridSummaryColumnDescriptor scd = oSummaryRow.SummaryRowDescriptor.GetSummaryColumnAtCol(i);
string CellValue =GridEngine.GetSummaryText(oSummaryRow.ParentGroup, scd)

Please let us know a method which will allow us to read the calculated summary value

2. We have a GroupingGrid control, which has n level of grouping.
The records populated under nth level of group have one column which is not part of the datasource and is populated via the QueryValue event of grid.
Please let us know a method to read this unbounded column value
Note: Each of the Records ahve nested table listed under them.

Thanks

Regards
Anju

Saravanan A [Syncfusion]
Replied On June 13, 2007 07:27 PM UTC

Hi Anju,

1, We want to read/iterate these summary values from the grid
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Please refer to this sample. It uses the Custom Summary class that computes the weighted average of the of entries.
http://websamples.syncfusion.com/samples/Grid.Windows/F62363/main.htm

In the above sample when you click the 'Get the summary values' button, it loops through all the SummaryColumnDescriptor in all the summary rows and print it in the output window.

2, Please let us know a method to read this unbounded column value
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
To get the unbounded column value of a record you can use the GetValue method of that record. To get the unbounded column values of all the records at the parent table you can loop through the Table.FilteredRecords collection, which contains all the records(from parent table) that are displayed in the grid.
Here is the code snippet.

GridTable gridTable = gridGroupingControl1.Table;
foreach (Record record in gridTable.FilteredRecords)
{
Console.WriteLine(record.GetValue("Unbound_ColumnName"));
}


Best Regards,
Saravanan

Anju
Replied On June 14, 2007 01:23 PM UTC

Hi Saravanan,
Thanks for inputs but thye did not help much

1. For the Summary row problem, the values are binded using methods which are being called from the event handler methods of the grid.
So the Summary type and the delegate are not set to Custom and method name respectively.
Isn't there any way I could read the displayed value once I get hold of the Summary row

2. For the Record value, I have tried the code and it returns a null. I unable to read only this first column, the rest of the column for the record are available.
This record, has nested table and the unbounded column serves as header for the nested column

Saravanan A [Syncfusion]
Replied On June 15, 2007 05:06 PM UTC

Hi Anju,

Issue 1:
Try calling the GetDisplayText method of the SummaryColumnDescriptor, to get the text displayed in the summary cell.
Here is the code snippet.

GridSummaryColumnDescriptor scd = summaryRow.SummaryRowDescriptor.GetSummaryColumnAtCol(index);
string text = scd.GetDisplayText(summaryRow.ParentGroup);


Issue 2:
Please refer to this sample.
http://websamples.syncfusion.com/samples/Grid.Windows/F62363_1/main.htm

In the above sample we have binded the grid to an hierarchical datasource and added an Unbounded column (which is getting populated using QueryValue event ) to the records at parent level. Now i dont find any issue in retreive the values of the unbounded column using Record.GetValue method.

Best Regards,
Saravanan

Anju
Replied On June 18, 2007 11:25 AM UTC

Hi,
Thanks Saravanan.

The issue 2 where in we could not retrieve values from unbound column has been resolved.
We used the Getvalue method with the fileddescriptor as parameter instead of the column name and it worked fine.

However the issue 1 still remains, GetDisplaytest did not resolve the problem. We still get the original aggregated values in summary rows instead of the custom calculated values

Similarly, in some rows the column values are calculated and assigned to the cell in the QueryCellStyleInfo method

Thanks and Regards
Anju

Saravanan A [Syncfusion]
Replied On June 18, 2007 06:30 PM UTC

Hi Anju,

If you are setting the summary value through QueryCellStyleInfo event, it will not get stored internally with the summary elements. So GridEngine.GetSummaryText and GetDisplayText methods will not return those values. In this case you can try getting the RowIndex and ColIndex of the summary cell and access the CellValue through the indexers of gridGroupingControl1.TableModel. This will trigger the QuerryCellStyleInfo event for that cell and then return the value.
Here is the code snippet.

int rowIndex = summaryRow.GetRowIndex();
GridTableDescriptor tableDescriptor = null;
foreach (GridSummaryColumnDescriptor scd in summaryRow.SummaryRowDescriptor.SummaryColumns)
{
tableDescriptor = scd.TableDescriptor;
int fieldIndex = tableDescriptor.NameToField(scd.DataMember);
int colIndex = scd.TableDescriptor.FieldToColIndex(fieldIndex);

Console.WriteLine(gridGroupingControl1.TableModel[rowIndex, colIndex].CellValue);
}


Best Regards,
Saravanan

Anju
Replied On June 19, 2007 11:05 AM UTC

Hi Saravanan,
The solution may work but the Summary row does not have method to fetch the Rowindex. Am I missing something...please let me know

also in your reply you have mentioned that if values are set in the queryStyleinfo event they will not be assigned inernally to the grid, so where would suggest that these values should be set so that they can be read easily.

In addition to this the Record values of some columns where they are calculated are also not retrieved properly so can you help me that as well

Thanks and Regards
Anju

Saravanan A [Syncfusion]
Replied On June 20, 2007 01:46 AM UTC

Hi Anju,

1, Summary row does not have method to fetch the Rowindex. Am I missing something...
>>>>>>>>>>>>>>>>>>>>>>>>>>>
Please refer to this sample.
http://websamples.syncfusion.com/samples/Grid.Windows/F62363_2/main.htm

2, where would suggest that these values should be set so that they can be read easily
>>>>>>>>>>>>>>>>>>>>>>>>>>>
Please refer to the samples named CustomSummary and WeightedSummary, that has been shipped along with the product. You can find them from the following paths.
\Syncfusion\EssentialStudio\5.1.0.51\Windows\Grid.Grouping.Windows\Samples\2.0\Summaries\CustomSummary\cs
\Syncfusion\EssentialStudio\5.1.0.51\Windows\Grid.Grouping.Windows\Samples\2.0\Summaries\WeightedSummary\cs

Also refer to this forum.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=21733

3, Record values of some columns where they are calculated are also not retrieved properly
>>>>>>>>>>>>>>>>>>>>>>>>>>
In GridGroupingControl, the record objects are directly refers to the datasource. When you try to get it's field value, it will directly fetch from the datasource. So if you asign it through QueryCellStyleInfo you will not be getting it through GetValue method. Try changing the underlying datasource directly.

Best Regards,
Saravanan

Anju
Replied On June 21, 2007 03:45 PM UTC

Hi Saravanan,
I have tried the code from Form1.cs --> button1_Click and get the following compilation error
Error 65 'Syncfusion.Windows.Forms.Grid.Grouping.GridSummaryRow' does not contain a definition for 'GetRowIndex'

Thanks & Regards
Anju

Saravanan A [Syncfusion]
Replied On June 22, 2007 12:23 AM UTC

Hi Anju,

GetRowIndex method has been introduced only to help debugging, so it is available only when the assemblies are in debug mode.

Please replace that line with the following line.

int rowIndex = gridGroupingControl1.Table.NestedDisplayElements.IndexOf(summaryRow);


Best Regards,
Saravanan

Anju
Replied On June 27, 2007 01:59 PM UTC

Thanks Saravanan, the solution seems to be working partially correct.

I say partially correct because in some case I do not get the correct columnindex,
In our grid all columns are not visible always and so the summary being displayed should be for the appropriate column.


below is the code being used
int rowIndex = RPGrid.Table.NestedDisplayElements.IndexOf((Element)oGrp);
GridTableDescriptor tableDescriptor = null;
foreach (GridSummaryColumnDescriptor scd in
oSummaryRow.SummaryRowDescriptor.SummaryColumns)
{
blnAdd = false;
for (int i = 1; i < RPGrid.TableDescriptor.VisibleColumns.Count; i++)
{
if (scd.Name == RPGrid.TableDescriptor.VisibleColumns[i].Name)
{
blnAdd = true;
break;
}
}
if (blnAdd)
{
tableDescriptor = scd.TableDescriptor;
int fieldIndex = tableDescriptor.NameToField(scd.DataMember);
int colIndex = scd.TableDescriptor.FieldToColIndex(fieldIndex);
strValue = RPGrid.TableModel[rowIndex, fieldIndex].FormattedText;
}



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;