on 07-23-2015 9:37 PM
Hi, I'm building a report on the fly and I need to create groups. From googling, it seems that I need to clone from an existing group. In order to that, I need a single group in my blank report. I'm trying to create a dynamic group as in http://www.encodedna.com/2013/06/dynamically-change-groups-crystalreports.htm but my Insert Group menu option is greyed out. Any ideas?
What SDK are you using and what version?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, I AM doing this in the SDK, I'm sorry for the bad answers, I just took over this Crystal Reports project and am just getting up to speed. I'm not sure where to get the SDK version. If it helps, the CrystalDecisions.CrystalReports.Engine assembly has a Runtime Version of v2.0.50727 and a Version of 13.0.2000.0.
OK now we are getting somewhere. I moved your post to the .NET SDK forum.
You don't need to start with a group, code below using the -1 index is to add a new group.
Not clear when/why you said "but my Insert Group menu option is greyed out. "
Does not make sense, except you may be trying to view the report after adding the group... I don't know, not enough info on the workflow...
Try this sample,
Dim boGroup As CrystalDecisions.ReportAppServer.DataDefModel.Group
Dim boTableIndex As Integer
Dim boTable As CrystalDecisions.ReportAppServer.DataDefModel.Table
Dim boField As CrystalDecisions.ReportAppServer.DataDefModel.Field
'get report object from session or create a new report object for unmanaged reports simply open the report here
If Not (Session("boReportDocument") Is Nothing) Then
boReportDocument = CType(Session("boReportDocument"), CrystalDecisions.CrystalReports.Engine.ReportDocument)
Else
boReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument()
boReportDocument.Load(Server.MapPath("SimpleRCAPIReport.rpt"))
Dim boReportClientDocument As CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument = boReportDocument.ReportClientDocument
'Create a new Group Object
boGroup = New CrystalDecisions.ReportAppServer.DataDefModel.Group
'Now find the database field that will be used as the grouping condition - you can reference it directly, but this method
'can be used if you only know the table name
boTableIndex = boReportClientDocument.DatabaseController.Database.Tables.FindByAlias("Customer")
boTable = boReportClientDocument.DatabaseController.Database.Tables(boTableIndex)
'Now get the field in the Table
boField = boTable.DataFields.FindField("{Customer.City}", CrystalDecisions.ReportAppServer.DataDefModel.CrFieldDisplayNameTypeEnum.crFieldDisplayNameFormula)
'Set that field as the field to group on
boGroup.ConditionField = boField
'And finally Add it to the report
boReportClientDocument.DataDefController.GroupController.Add(-1, boGroup)
End If
For more samples click on the Overview tab and on the left you'll find a link to download sample applications.
Don
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.