Summarizing an existing datatable

Joined
Feb 15, 2005
Messages
10
I am trying to summarize an existing datatable but have so far been unable to do so. I have a dataset called Results that I need to have displayed in two ways: all the details, and a summary. The Results datatable has 3 columns; Filter, Expression, Value.
I want to be able to display the Expression and Value in the DetailDataGrid where the Filter is equal to the value in the FilterComboBox. Currently the DetailDataGrid is being populated as it should be.
I also want to be able to summarize the Results table in the SummaryDataGrid. I want to find out how many records there are for each Expression having the Filter equal to the value in the FilterComboBox. This data is not coming out of a database, else I would make another call to the database with the query SELECT [Expression], Count([Expression]) FROM TABLE HAVING [Filter] = "Filter" GROUP BY [Expression].
I have tried to compute and select methods of the dataset but have had no luck so far. Is what I am trying to do possible?
Here is the code I am using:
[VB]Dim ResultDataSet As New DataSet
ResultDataSet.Tables.Add(Results)
ResultDataSet.Tables("Results").DefaultView.RowFilter = "[Filter] = " & FilterComboBox.Text & ""
DetailDataGrid.DataSource = ResultDataSet.Tables("Results").DefaultView
SummaryDataGrid.DataSource = ResultDataSet.Tables("Results").Compute("Count([Expression])", "[Filter] = " & FilterComboBox.Text & "")[/VB]
Any ideas or suggestions?
 
Is it just not possible?
The only other thing I can think of to do is create a database file and write all the entries to it and then query the results back to the program. That seems like an awful way to do it though.
 
Back
Top