Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

FieldMapping event does not fire - does it work or not..?

We change the datasource of a report from ODBC into XML. The column names are different. We enable the FieldMapping Event, but it doesn't fire.

Is there a known problem..?

Does it work??

We like to know if we have to invest more time or can better search another solution.

Tia

Hans

Our code:


                report.Load(@"D:\Test\CR\afroep_xml_omgezet.rpt");
                report.AfterFormatPage += new FormatPageEventHandler(report_AfterFormatPage);
                report.BeforeFormatPage += new FormatPageEventHandler(report_BeforeFormatPage);
                report.NoData += new FormatPageEventHandler(report_NoData);
                report.FieldMapping += new FieldMappingEventHandler(report_FieldMapping);
                report.FormatSection += new FormatSectionEventHandler(report_FormatSection);

                EventEnabledArgs enableArgs = new EventEnabledArgs();
                enableArgs.FieldMappingEnabled = true;
                enableArgs.FormattingEnabled = true;
                report.EnableEvent(enableArgs);

                report = ChangeConnectionInfo(report);
                report.VerifyDatabase();  <- does not trigger the FieldMappint event; reports does not shown any fields


        void report_FieldMapping(FieldMappingEventArgs fieldMappingargs)
        {
            Console.WriteLine("report_FieldMapping");
            String aa = fieldMappingargs.ReportFieldsMappings[0].FieldName;
            fieldMappingargs.ReportFieldsMappings[0].FieldName = "Customer ID";
            fieldMappingargs.ReportFieldsMappings[0].MappingToFieldIndex = 1;
            fieldMappingargs.ReportFieldsMappings[0].TableName = "Customer";
            ////FieldMappingEventData a = new FieldMappingEventDataClass();
            //a.ReportFieldsMappingInfoList[0].DatabaseFieldName = "Customer ID";                     
        }

Former Member
replied
Not what you were looking for? View more on this topic or Ask a question