cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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";                     
        }

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

See this post for the original:

Answers (2)

Answers (2)

0 Kudos

Hi Hans,

Yes it should, Trevor did test it but it only works when the database driver changes. I'm going to close this post since you have the other one going.

I suggest you purchase a case and a Rep here can work with you. We'll need to get your reports and data sources, old and new.

We can't attach files to forums.

Thank you

Don

former_member208657
Active Contributor
0 Kudos

Last time I saw field mapping work they way you expect it to was with the RDC. In the CR .NET SDK, if your fields aren't present or don't match we'll just drop the data from the report. If you plan to change database drivers you should ensure all your table and field names remain exactly the same.