T
TaeHo Yoo
After running my code, group tree(the left section of the report)
changes but not the content in the report.
My code is
----------------------------------------------------------
Private Sub btnModifyGrouping_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnModifyGrouping.Click
Dim myReport As New Report1()
Dim crGroups As CrystalDecisions.CrystalReports.Engine.Groups
Dim crGroup As CrystalDecisions.CrystalReports.Engine.Group
Dim crField As
CrystalDecisions.CrystalReports.Engine.FieldDefinition
'Modify the group to use CustomerName rather than OrderDate
'Get the field to base the group on
crField = myReport.Database.Tables("Customer").Fields("Customer
Name")
'Access the group by traversing the groups collection
crGroups = myReport.DataDefinition.Groups
For Each crGroup In crGroups
If crGroup.ConditionField.Name = "Order Date" Then
crGroup.ConditionField = crField
End If
Next
'Refresh the Viewer with the new report object
CrystalReportViewer1.ReportSource = myReport
CrystalReportViewer1.Refresh()
End Sub
changes but not the content in the report.
My code is
----------------------------------------------------------
Private Sub btnModifyGrouping_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnModifyGrouping.Click
Dim myReport As New Report1()
Dim crGroups As CrystalDecisions.CrystalReports.Engine.Groups
Dim crGroup As CrystalDecisions.CrystalReports.Engine.Group
Dim crField As
CrystalDecisions.CrystalReports.Engine.FieldDefinition
'Modify the group to use CustomerName rather than OrderDate
'Get the field to base the group on
crField = myReport.Database.Tables("Customer").Fields("Customer
Name")
'Access the group by traversing the groups collection
crGroups = myReport.DataDefinition.Groups
For Each crGroup In crGroups
If crGroup.ConditionField.Name = "Order Date" Then
crGroup.ConditionField = crField
End If
Next
'Refresh the Viewer with the new report object
CrystalReportViewer1.ReportSource = myReport
CrystalReportViewer1.Refresh()
End Sub