Skip to Content
0
Jun 09, 2022 at 01:47 PM

Crystal report group: How to change group by field

128 Views Last edit Jun 09, 2022 at 08:23 PM 2 rev

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>