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. Image for the cookie policy date
close icon

GetSummaryText when RecordValueChanged

I have a self-referential table with "ID","NAME","COST" and "FID" fields.When the "COST" value changed at level n,I want to set the "COST" value at level n-1 as sum of "COST" value at level n,the "COST" value at level n-2 as sum of "COST" value at level n-1 ...,and so on.

My code is here.It dosn't work as what I want.What's wrong with me?
Private Sub GridGroupingControl1_RecordValueChanged(ByVal sender As Object, ByVal e As Syncfusion.Grouping.RecordValueChangedEventArgs) Handles GridGroupingControl1.RecordValueChanged
If e.Record.TableLevel <> -1 Then
If e.Column = "Cost" Then
If Not (e.Record.ParentChildTable.ParentDisplayElement.GetRecord Is Nothing) Then
Dim g As Group = CType(IIf(TypeOf e.Record.ParentGroup Is Group, e.Record.ParentGroup, Nothing), Group)
e.Record.ParentChildTable.ParentDisplayElement.GetRecord.SetValue("Cost", GridEngine.GetSummaryText(g, "SumR", "SumC"))
End If
End If
End If
End Sub


Regards,
LaoXu



2 Replies

AD Administrator Syncfusion Team March 17, 2008 03:10 PM UTC

Hi laoxu,

we are working on the forum.. we will update you soon.. Thanks for your interest in syncfusion products..

regards,
Janagan



AD Administrator Syncfusion Team March 26, 2008 10:03 PM UTC

Hi laxou,

You need to add the SummaryRowDescriptor for each self relation table in a GroupingGrid. Below are the codes that shows you "How to add the Count summary for SelfRelation table in GroupingGrid?".

private GridRelationDescriptor AddManualRelations( GridTableDescriptor parentgridTableDescriptor )
{
GridRelationDescriptor parentToChildRelationDescriptor = new GridRelationDescriptor( );
parentToChildRelationDescriptor.ChildTableName = "SelfReferencingTable"; // same as SourceListSetEntry.Name for childTable (see below)
parentToChildRelationDescriptor.RelationKind = RelationKind.RelatedMasterDetails;
parentToChildRelationDescriptor.RelationKeys.Add( "DEPTNO", "ADMRDEBT" );

// Add relation to ParentTable
parentgridTableDescriptor.Relations.Add( parentToChildRelationDescriptor );
parentgridTableDescriptor.AllowNew = false;
parentgridTableDescriptor.AllowEdit = false;
GridSummaryColumnDescriptor totalSum = new GridSummaryColumnDescriptor("CumBuyQty");
totalSum.SummaryType = SummaryType.Count;
totalSum.Style = GridSummaryStyle.Column;
totalSum.DataMember = "DEPTNO";
totalSum.DisplayColumn = "DEPTNO";
totalSum.Format = "{Count:#}";

GridSummaryRowDescriptor sRow = new GridSummaryRowDescriptor("Totals", totalSum);
parentToChildRelationDescriptor.ChildTableDescriptor.SummaryRows.Add(sRow);
return parentToChildRelationDescriptor;
}

Please refer to the attached sample for implementation and let me know if this helps.
http://websamples.syncfusion.com/samples/SelfRelations.zip

Best regards,
Haneef


Loader.
Live Chat Icon For mobile
Up arrow icon