Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Aggregate on Filtered Child Relations Rows [C# - .NET 2.0]
 

Aggregate on Filtered Child Relations Rows [C# - .NET 2.0]

Hy Everyone,

I'm stuck on this problem, I have 2 tableswith a parent-child relation, I would like to create a computed column in the parent table based on data of the child table, butI would like to filter the child data. So, with DataColumn.Expression, I couldn't do "Sum(...)" with a filter criteria,instead I found DataTable.Compute() but the result seems to be slow, my parent and child table have about 10,000 rows each.

Has anyone another solution?

Sam

BarzotSam  Tuesday, June 26, 2007 6:46 AM

For 10000 rows i would have a scalar valued function in my database for speed.

hrubesh  Tuesday, June 26, 2007 6:53 AM

Hi, the fact that I'll will connect to the Db for each values, is going to be more slowly than loading the entire tables. I'm not using Sql server, but Caché from Intersystems.

Sam

BarzotSam  Tuesday, June 26, 2007 6:58 AM

hi , i am not sure how the cache interfacing will be, but

my point is like that: when you have your filter , have a method to directly access the database and runs a query that satisfy the required return value, in this case only a double for your sum, this should definitely be possible.

hrubesh  Tuesday, June 26, 2007 7:22 AM

Hi,

Thx for your answer, I see your point, I would sur work, but with Caché every connection has its cost, so what I made is two query with the needed filtered data en computed column, I have then two tables related to the parents tables, I know it's not a good idea, cuz it would mean I will need a query for each filter and a table related, but for sure it's faster that way.

Thx for your help anyway hrubesh (y)

Sam

BarzotSam  Tuesday, June 26, 2007 8:23 AM

ok good luck programming cache .

why a (y) after the name?

hrubesh  Tuesday, June 26, 2007 8:29 AM

Sorry it's was the msn emoticones for the thumb up.

Sam

BarzotSam  Tuesday, June 26, 2007 11:16 AM

I had another question in the same problem, I would like to do a Sum aggregate on child relations like this. In Expression in the DataColumn.

Sum (Child.aRow - Child.aNotherRow)

is that possible?

BarzotSam  Tuesday, June 26, 2007 11:19 AM

You can use google to search for other answers

Custom Search

More Threads

• Public DataSet
• DataGridView problem
• DataTable RowChanged Event
• how to capture datagirdview databound combobox selectindexchanged event...
• DataGridView cell validation problem
• On Validation, Value is rounded!
• Hetrogenous Column in datagridview
• Show always the scrollbar in a DataGridView
• Disable Datagrid Row selection
• Table or DatGrid...