Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add/modify filters of a report. I'm using BO XI R2

Status
Not open for further replies.

ameetmore9

Programmer
Joined
Sep 7, 2010
Messages
2
Location
GB
I'm using BO XI R2.
I want to modify the report.
Following is a code snippet which throws InvalidCastException ;
and under that the Message is No Such Interfaces Supported .
Kindly suggest me a solution, if you have been able to crack it.
Also any ideas why such an exception.

using CrystalDecisions.CrystalReports.TemplateEngine;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.ObjectFactory;
using CrystalDecisions.ReportAppServer.DataDefModel;
using CrystalDecisions.ReportAppServer.Controllers;
using CrystalDecisions.ReportAppServer.CommonObjectModel;
using CrystalDecisions.ReportAppServer.ReportDefModel;
ReportClientDocument reportClientDocument = new ReportClientDocument();

SessionMgr sessionMgr = new SessionMgr();
EnterpriseSession enterpriseSession;
EnterpriseService enterpriseService;
InfoStore infoStore;
InfoObjects infoObjects;
InfoObject infoObject;
ReportAppFactory reportAppFactory;
string sampleReportName;

enterpriseSession = sessionMgr.Logon("administrator","","localhost","secEnterprise");
enterpriseService = enterpriseSession.GetService("InfoStore");
infoStore = new InfoStore(enterpriseService);

sampleReportName = "World Sales Report";
infoObjects = infoStore.Query("Select SI_ID From CI_INFOOBJECTS Where SI_NAME='" + sampleReportName + "' And SI_INSTANCE=0");
infoObject = infoObjects[1];

reportAppFactory = (ReportAppFactory)enterpriseSession.GetService("","RASReportFactory").Interface;

reportClientDocument = reportAppFactory.OpenDocument(infoObject.ID,0);
Filter filter = new FilterClass();
filter.FreeEditingText = "{Trade.Trade Date} = '12/03/2009'";
reportClientDocument.DataDefController.RecordFilterController.Modify(filter);




reportClientDocument = reportAppFactory.OpenDocument(infoObject.ID,0);
code segment throws the Exception

Any alternatives to the above method since reportclientdocument is not getting created.

Regards,
Ameet
 
Also some further info.
I'm using VS 2008 and C#.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top