I have a GGC whose datasource is based on 3 nested tables, "Employees", "Orders" and "Details". In the grid, following, or at the beginning of each Employee, I''d like to show a summary row that sums up the values of a column ("Hours") in all the Details rows for that employee.
One problem is that the column ("Hours") to be summed is an unbound field which is computed in a handler for QueryValue. I have looked at the SummaryInCaption sample, but it is based on a "flat" table, rather than nested tables, and I cannot figure out how to accomplish what I need to do.
Thanks,
Van Baker
AD
Administrator
Syncfusion Team
August 31, 2005 03:58 PM UTC
I was working on a sample, but came to realize I was not clear on what you wanted.
How are things setup? The 3 tables are related tables with Employees being the parent, Orders being the child and Details being the grandchild. Or, are Employess, Orders and Details all sibling tables on teh same level?
Which table has the unbound Hours column in it?
Are you grouping anything?
VB
vbaker
August 31, 2005 04:20 PM UTC
Employees is the Parent, Orders the child and Details the grandchild. I added two Relations to a DataSet to establish these relationships using primary/foreign keys EmployeeID to relate Employees and Orders, and OrderID to relate Details and Orders. I specified the DataSet to be the grid''s DataSource and "Employees" to be the DataMember.
The unbound Hours column is in the grandchild table, "Details" and its value is computed based on two other column values in the same Details row. I did not intend to group anything explicitly using the grid, since it is my understanding that the table relationships will automatically group child items under their parents, which is what I want.
Thanks,
Van Baker
AD
Administrator
Syncfusion Team
August 31, 2005 05:46 PM UTC
Here is a little sample.
http://www.syncfusion.com/Support/user/uploads/GGC_NestedCaptionSummary_14df69e0.zip
It adds an unbound column, Hours, at each level. It also add a summary row to both the GrandChild and Child tables.
On the GrandChild level, the Hours values are just some random numbers. The summary row added to the GrandChild sums up the hours column.
On the Child level, the unbound column is populated using the summary results from the GrandChild table. The summaryrow added to the Child table sums up the hours column in the Child.
Finally, the unbound column in the parent is populated from the summaryrow in the Child.
I think this is what you described. You would be free to hide the summaryrows / unbound columns in some or all the tables.
VB
vbaker
August 31, 2005 07:34 PM UTC
Hi Clay,
This is absolutely perfect! A simple yet very elegant solution.
Thanks so much,
Van Baker