dynamic "group by" change doesn't work

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top