cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal report group: How to change group by field

0 Kudos

Hello,

I am migrating one report using CR2020 SDK, I need to change Group property and edit the field name with group.

For example: Earlier it was A. Address

Now I like to change field information like: B.Address

I can see that field information can be changed but How I can change the table alias name also. Please suggest :

           for (int i = 0; i < rptSrcClientDocument.DataDefinition.Groups.Count; i++)
            {
                CrystalDecisions.ReportAppServer.DataDefModel.ISCRGroup srcGroup = (CrystalDecisions.ReportAppServer.DataDefModel.ISCRGroup)rptSrcClientDocument.DataDefinition.Groups[i];
                CrystalDecisions.ReportAppServer.DataDefModel.Group srcFormulaFieldInsert = srcGroup.Clone(true);

                Object oldGrp = (object)rptSrcClientDocument.DataDefinition.Groups[i];
                ISCRField conFild = srcGroup.ConditionField;
                //It allows filed name like conFild.Name = "{Address" but do not allow like below 
                conFild.Name = "{B.Address}";<br>                srcFormulaFieldInsert.ConditionField = conFild;
               rptSrcClientDocument.DataDefController.GroupController.Remove(oldGrp);

                rptSrcClientDocument.DataDefController.GroupController.Add(i, srcFormulaFieldInsert);
            }<br>
View Entire Topic
0 Kudos

Hi Yogesh,

To change it you need to Clone() the group first, then make the change and then delete the original and replace it with the new.

Look in my sample for cloning.

Don