SAP Knowledge Base Article - Public

1300650 - How to add a record filter to a report using the Crystal Reports .NET inproc RAS SDK

Symptom

How to add a record filter to a report using the Crystal Reports .NET inproc RAS SDK?

Reproducing the Issue

  • Crystal Reports XI Release 2 Service Pack 2 and higher
  • C#
  • Resolution

    sample code:

                using CrystalDecisions.CrystalReports.Engine;
                using CrystalDecisions.ReportAppServer.ClientDoc;
                using CrystalDecisions.ReportAppServer.DataDefModel;
                using CrystalDecisions.ReportAppServer.Controllers;

                //CR Declarations
                ReportDocument                           m_boReportDocument;
                ISCDReportClientDocument        m_boReportClientDocument;


                //create a new ReportDocument
                m_boReportDocument = new ReportDocument();

                //load the RPT file
                m_boReportDocument.Load("..\\..\\Dummy.rpt");     

                //access the ReportClientDocument in the ReportDocument (EROM bridge)
                m_boReportClientDocument = boReportDocument.ReportClientDocument;
            
                Filter m_boFilter = new CrystalDecisions.ReportAppServer.DataDefModel.Filter();
                m_boFilter.FreeEditingText = "{Customer.Last Year's Sales} > 75000";

                boReportClientDocument.DataDefController.RecordFilterController.Modify(m_boFilter);
       
                
                //display in reportviewer
                crystalReportViewer1.ReportSource = boReportDocument;

    Keywords

    How add record filter report Crystal Reports .NET inproc RAS SDK , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

    Product

    SAP Crystal Reports XI R2