ComponentOne Filtered DataGrid to Crystal Report

DavidT_macktool

Well-known member
Joined
Oct 21, 2004
Messages
502
Location
Indiana
Programming Experience
3-5
I have a ComponentOne TrueDBGrid with the filter bar active. I want to filter the grid by some column and then use the filtered data in a Crystal report.
My first thought was to create a temporary data set and fill it with the record id's by looping through the grid. So far so good. Here is the code:
'Loop through Grid and store ID Value
GageGrid.Row = 0
Dim c As Integer = GageGrid.VisibleRows
Dim i As Integer
TempGage = New DataTable("TempGage")
Dim TestRow1 As DataRow
Dim GageId As DataColumn = New DataColumn("GageId")
GageId.DataType = System.Type.GetType("System.String")
TempGage.Columns.Add(GageId)
For i = 1 To c
Try
TestRow1 = TempGage.NewRow()
TestRow1.Item("GageId") = GageGrid.Columns("Gage ID").Value
TempGage.Rows.Add(TestRow1)
Catch ex As Exception
'do nothing
End Try
GageGrid.Row += 1
Next

Shortly after this I was going to call a report viewer form and set the report datasource to this temp table.
Here's the thing: The temp table only contains the ID field, I need to Join it back to the full dataset to get all the info needed on the report. I haven't got a clue...
Any ideas? I have not used a PUSH format report yet, but everything leads me in that direction. I can probably figure that out. I need help on recombining the dataset so I can display all the fields.

Am I way off? Ideas for a better way? I'll try anything.

Thanks for reading.
 
Nevermind...

I am using another SQL adapter and dataset (identical to the first but different names). I do not load or update the dataset through the datasource. Instead, I am Loading it with the values from the grid and setting it to a public DataTable. I can then push the public datatable to crystal reports and use the "filtered" records that way. As long as I never update the datasource with the temp table/dataset I won't overwrite the full dataset.

simple huh?
 
Back
Top